Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cGuiBackendHelpbox
  • cGuiFileOverview
  • cGuiFoldingRow
  • cGuiList
  • cGuiMenu
  • cGuiNavigation
  • cGuiNotification
  • cGuiObjectPager
  • cGuiPage
  • cGuiScrollList
  • cGuiSourceEditor
  • cGuiTableForm
  • cGuiTree
  • cPager
  • cTemplate
  • cTree
  • cTreeItem
  • NoteLink
  • NoteList
  • NoteListItem
  • NoteView
  • TODOLink
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains various to-do classes.
  4:  *
  5:  * @package Core
  6:  * @subpackage Backend
  7:  * @author Unknown
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: /**
 17:  * This class uses the communication collection to serve a special collection
 18:  * for to-do entries.
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class TODOCollection extends cApiCommunicationCollection {
 24: 
 25:     /**
 26:      * Constructor to create an instance of this class.
 27:      */
 28:     public function __construct() {
 29:         parent::__construct();
 30:         $this->_setItemClass('TODOItem');
 31:     }
 32: 
 33:     /**
 34:      * Selects all entries from the database.
 35:      * Objects are loaded using their primary key.
 36:      *
 37:      * @param string $where [optional]
 38:      *         Specifies the where clause.
 39:      * @param string $group_by [optional]
 40:      *         Specifies the group by clause.
 41:      * @param string $order_by [optional]
 42:      *         Specifies the order by clause.
 43:      * @param string $limit [optional]
 44:      *         Specifies the limit by clause.
 45:      * @return bool
 46:      *         True on success, otherwise false
 47:      */
 48:     public function select($where = '', $group_by = '', $order_by = '', $limit = '') {
 49:         if ($where == '') {
 50:             $where = "comtype='todo'";
 51:         } else {
 52:             $where .= " AND comtype='todo'";
 53:         }
 54: 
 55:         return parent::select($where, $group_by, $order_by, $limit);
 56:     }
 57: 
 58:     /**
 59:      * Creates a new communication item
 60:      *
 61:      * @param string $itemtype
 62:      * @param int $itemid
 63:      * @param int|string $reminderdate
 64:      *          if not given as timestamp it is expected to be a string
 65:      *          using the English date format
 66:      * @param string $subject
 67:      * @param string $content
 68:      * @param string $notimail
 69:      * @param string $notibackend
 70:      * @param string $recipient
 71:      * @return cApiCommunication
 72:      */
 73:     public function createItem($itemtype, $itemid, $reminderdate, $subject, $content, $notimail, $notibackend, $recipient) {
 74:         $item = parent::create();
 75: 
 76:         $item->set('comtype', 'todo');
 77:         $item->set('subject', $subject);
 78:         $item->set('message', $content);
 79:         $item->set('recipient', $recipient);
 80:         $item->store();
 81: 
 82:         if ($notimail === true) {
 83:             $notimail = 1;
 84:         }
 85: 
 86:         // Is the date passed as string?
 87:         if (!is_numeric($reminderdate)) {
 88:             // Convert to timestamp
 89:             $reminderdate = strtotime($reminderdate);
 90:         }
 91: 
 92:         $item->setProperty('todo', 'reminderdate', $reminderdate);
 93:         $item->setProperty('todo', 'itemtype', $itemtype);
 94:         $item->setProperty('todo', 'itemid', $itemid);
 95:         $item->setProperty('todo', 'emailnoti', $notimail);
 96:         $item->setProperty('todo', 'backendnoti', $notibackend);
 97:         $item->setProperty('todo', 'status', 'new');
 98:         $item->setProperty('todo', 'priority', 'medium');
 99:         $item->setProperty('todo', 'progress', '0');
100: 
101:         return $item;
102:     }
103: 
104:     /**
105:      *
106:      * @return array
107:      */
108:     public function getStatusTypes() {
109:         return array(
110:             'new' => i18n('New'),
111:             'progress' => i18n('In progress'),
112:             'done' => i18n('Done'),
113:             'waiting' => i18n('Waiting for action'),
114:             'deferred' => i18n('Deferred')
115:         );
116:     }
117: 
118:     /**
119:      *
120:      * @return array
121:      */
122:     public function getPriorityTypes() {
123:         return array(
124:             'low' => i18n('Low'),
125:             'medium' => i18n('Medium'),
126:             'high' => i18n('High'),
127:             'immediately' => i18n('Immediately')
128:         );
129:     }
130: }
131: 
132: /**
133:  * This class uses the communication collection to serve a special collection
134:  * for to-do entries.
135:  *
136:  * @package Core
137:  * @subpackage GenericDB_Model
138:  */
139: class TODOItem extends cApiCommunication {
140: 
141:     /**
142:      * Sets a custom property.
143:      *
144:      * @see Item::setProperty()
145:      * @param string $type
146:      *         Specifies the type
147:      * @param string $name
148:      *         Specifies the name
149:      * @param mixed $value
150:      *         Specifies the value
151:      * @param int $client [optional]
152:      *         unused (should be "Id of client to set property for")
153:      * @return bool
154:      */
155:     public function setProperty($type, $name, $value, $client = 0) {
156:         if ($type == 'todo' && $name == 'emailnoti') {
157:             if ($value) {
158:                 parent::setProperty('todo', 'emailnoti-sent', false);
159:                 $value = true;
160:             } else {
161:                 $value = false;
162:             }
163:         }
164: 
165:         return parent::setProperty($type, $name, $value);
166:     }
167: }
168: 
169: /**
170:  * This class uses the link GUI class to serve a special link for to-do entries.
171:  *
172:  * @package Core
173:  * @subpackage GUI
174:  */
175: class TODOLink extends cHTMLLink {
176: 
177:     /**
178:      * Constructor to create an instance of this class.
179:      *
180:      * @param string $itemtype
181:      * @param int $itemid
182:      * @param string $subject
183:      * @param string $message
184:      */
185:     public function __construct($itemtype, $itemid, $subject, $message) {
186:         global $sess;
187:         parent::__construct();
188: 
189:         $subject = urlencode($subject);
190:         $message = urlencode($message);
191: 
192:         $this->setEvent('click', 'javascript:window.open(' . "'" . $sess->url("main.php?subject=$subject&message=$message&area=todo&frame=1&itemtype=$itemtype&itemid=$itemid") . "', 'todo', 'scrollbars=yes,resizable=yes,height=350,width=625');");
193:         $this->setEvent('mouseover', "this.style.cursor='pointer'");
194: 
195:         $img = new cHTMLImage('images/but_setreminder.gif');
196:         $img->setClass("vAlignMiddle tableElement");
197: 
198:         $img->setAlt(i18n('Set reminder / add to todo list'));
199:         $this->setLink('#');
200:         $this->setContent($img->render());
201:         $this->setAlt(i18n('Set reminder / add to todo list'));
202:     }
203: }
204: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0