<?php
 
class NP_MoveToDrafts extends NucleusPlugin {
 
   // name of plugin
   function getName() {
      return 'MoveToDrafts';
   }
 
   // author of plugin
   function getAuthor()  {
      return 'Felix';
   }
 
   // an URL to the plugin website
   // can also be of the form mailto:foo@bar.com
   function getURL()
   {
      return 'blog.nesciens.net';
   }
 
   // version of the plugin
   function getVersion() {
      return '0.1';
   }
 
   // a description to be shown on the installed plugins listing
   function getDescription() {
      return 'Provides you with means to move already posted items back to drafts.';
   }
 
   function supportsFeature($what) {
      switch($what)
      {
         case 'SqlTablePrefix':
         return 1;
         default:
         return 0;
      }
   }
 
   function getEventList() { return array('EditItemFormExtras','PreUpdateItem'); }
 
 
   function event_PreUpdateItem(&$data) {
      $MoveToDrafts = postvar("np_MoveToDrafts");
      if($MoveToDrafts == 1) {sql_query("UPDATE ".sql_table('item')." SET idraft=1 WHERE inumber=".$data["itemid"]);}
   }
 
        function event_EditItemFormExtras(&$data) {
      if($data["variables"]["draft"]==0)
      {
      ?>
         <input type="checkbox" value="1" name="np_MoveToDrafts" id="np_MoveToDrafts" /> <label for="np_MoveToDrafts">Save as draft</label>
      <?
      }
   }
   }
?>
np_movetodrafts_code.txt · Last modified: 2006/07/05 13:03 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki