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:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Unknown
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * This class uses the communication collection to serve a special collection
 20:  * for to-do entries.
 21:  *
 22:  * @package Core
 23:  * @subpackage GenericDB_Model
 24:  */
 25: class TODOCollection extends cApiCommunicationCollection {
 26: 
 27:     /**
 28:      */
 29:     public function __construct() {
 30:         parent::__construct();
 31:         $this->_setItemClass('TODOItem');
 32:     }
 33: 
 34:     /**
 35:      * Selects all entries from the database.
 36:      * Objects are loaded using their primary key.
 37:      *
 38:      * @param string $where [optional]
 39:      *         Specifies the where clause.
 40:      * @param string $group_by [optional]
 41:      *         Specifies the group by clause.
 42:      * @param string $order_by [optional]
 43:      *         Specifies the order by clause.
 44:      * @param string $limit [optional]
 45:      *         Specifies the limit by clause.
 46:      * @return bool
 47:      *         True on success, otherwise false
 48:      */
 49:     public function select($where = '', $group_by = '', $order_by = '', $limit = '') {
 50:         if ($where == '') {
 51:             $where = "comtype='todo'";
 52:         } else {
 53:             $where .= " AND comtype='todo'";
 54:         }
 55: 
 56:         return parent::select($where, $group_by, $order_by, $limit);
 57:     }
 58: 
 59:     /**
 60:      * Creates a new communication item
 61:      *
 62:      * @param unknown_type $itemtype
 63:      * @param unknown_type $itemid
 64:      * @param unknown_type $reminderdate
 65:      * @param string $subject
 66:      * @param string $content
 67:      * @param unknown_type $notimail
 68:      * @param unknown_type $notibackend
 69:      * @param string $recipient
 70:      * @return cApiCommunication
 71:      */
 72:     public function createItem($itemtype, $itemid, $reminderdate, $subject, $content, $notimail, $notibackend, $recipient) {
 73:         $item = parent::create();
 74: 
 75:         $item->set('comtype', 'todo');
 76:         $item->set('subject', $subject);
 77:         $item->set('message', $content);
 78:         $item->set('recipient', $recipient);
 79:         $item->store();
 80: 
 81:         if ($notimail === true) {
 82:             $notimail = 1;
 83:         }
 84: 
 85:         // Is the date passed as string?
 86:         if (!is_numeric($reminderdate)) {
 87:             // Convert to timestamp
 88:             $reminderdate = strtotime($reminderdate);
 89:         }
 90: 
 91:         $item->setProperty('todo', 'reminderdate', $reminderdate);
 92:         $item->setProperty('todo', 'itemtype', $itemtype);
 93:         $item->setProperty('todo', 'itemid', $itemid);
 94:         $item->setProperty('todo', 'emailnoti', $notimail);
 95:         $item->setProperty('todo', 'backendnoti', $notibackend);
 96:         $item->setProperty('todo', 'status', 'new');
 97:         $item->setProperty('todo', 'priority', 'medium');
 98:         $item->setProperty('todo', 'progress', '0');
 99: 
100:         return $item;
101:     }
102: 
103:     /**
104:      *
105:      * @return array
106:      */
107:     public function getStatusTypes() {
108:         return array(
109:             'new' => i18n('New'),
110:             'progress' => i18n('In progress'),
111:             'done' => i18n('Done'),
112:             'waiting' => i18n('Waiting for action'),
113:             'deferred' => i18n('Deferred')
114:         );
115:     }
116: 
117:     /**
118:      *
119:      * @return array
120:      */
121:     public function getPriorityTypes() {
122:         return array(
123:             'low' => i18n('Low'),
124:             'medium' => i18n('Medium'),
125:             'high' => i18n('High'),
126:             'immediately' => i18n('Immediately')
127:         );
128:     }
129: }
130: 
131: /**
132:  * This class uses the communication collection to serve a special collection
133:  * for to-do entries.
134:  *
135:  * @package Core
136:  * @subpackage GenericDB_Model
137:  */
138: class TODOItem extends cApiCommunication {
139: 
140:     /**
141:      * Sets a custom property.
142:      *
143:      * @todo should return return value of overloaded method
144:      * @see Item::setProperty()
145:      * @param string $sType
146:      *         Specifies the type
147:      * @param string $sName
148:      *         Specifies the name
149:      * @param mixed $mValue
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:         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:      *
179:      * @param unknown_type $itemtype
180:      * @param unknown_type $itemid
181:      * @param unknown_type $subject
182:      * @param unknown_type $message
183:      */
184:     public function __construct($itemtype, $itemid, $subject, $message) {
185:         global $sess;
186:         parent::__construct();
187: 
188:         $subject = urlencode($subject);
189:         $message = urlencode($message);
190: 
191:         $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');");
192:         $this->setEvent('mouseover', "this.style.cursor='pointer'");
193: 
194:         $img = new cHTMLImage('images/but_setreminder.gif');
195:         $img->setClass("vAlignMiddle tableElement");
196: 
197:         $img->setAlt(i18n('Set reminder / add to todo list'));
198:         $this->setLink('#');
199:         $this->setContent($img->render());
200:         $this->setAlt(i18n('Set reminder / add to todo list'));
201:     }
202: }
203: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0