Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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

  • ArticleForumRightBottom
  • cApiClickableAction
  • cApiClickableQuestionAction
  • cGuiBackendHelpbox
  • cGuiFileOverview
  • cGuiFoldingRow
  • cGuiList
  • cGuiMenu
  • cGuiNavigation
  • cGuiNotification
  • cGuiObjectPager
  • cGuiPage
  • cGuiScrollList
  • cGuiSourceEditor
  • cGuiTableForm
  • cGuiTree
  • cPager
  • cTemplate
  • cTree
  • cTreeItem
  • NoteLink
  • NoteList
  • NoteListItem
  • NoteView
  • TODOBackendList
  • TODOLink
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the clickable action and clickable question action widget
  4:  * class.
  5:  *
  6:  * @package Core
  7:  * @subpackage GUI
  8:  * @version SVN Revision $Rev:$
  9:  *
 10:  * @author Unknown
 11:  * @copyright four for business AG <www.4fb.de>
 12:  * @license http://www.contenido.org/license/LIZENZ.txt
 13:  * @link http://www.4fb.de
 14:  * @link http://www.contenido.org
 15:  */
 16: 
 17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 18: 
 19: /**
 20:  * cApiClickableAction is a subclass of cApiAction.
 21:  * It provides an image for visual representation. Inherited classes should call
 22:  * the "setNamedAction" operation in their constructors;
 23:  * on-the-fly-implementations should call it directly after creating an object
 24:  * instance.
 25:  * @deprecated 2013-11-17 This class is not longer supported.
 26:  * @package Core
 27:  * @subpackage GUI
 28:  */
 29: class cApiClickableAction extends cApiAction {
 30: 
 31:     /**
 32:      * Help text
 33:      */
 34:     private $_helpText;
 35: 
 36:     /**
 37:      * cHTMLLink for rendering the icon
 38:      */
 39:     protected $_link;
 40: 
 41:     /**
 42:      * cHTMLImage for rendering the icon
 43:      */
 44:     private $_img;
 45: 
 46:     /**
 47:      *
 48:      * @var string
 49:      */
 50:     const QUESTIONACTION_PROMPT = 'prompt';
 51: 
 52:     /**
 53:      *
 54:      * @var string
 55:      */
 56:     const QUESTIONACTION_YESNO = 'yesno';
 57: 
 58:     /**
 59:      */
 60:     public function __construct() {
 61:         global $area;
 62: 
 63:         parent::__construct();
 64: 
 65:         $this->_area = $area;
 66:         $this->_frame = 4;
 67:         $this->_target = "right_bottom";
 68: 
 69:         $this->_link = new cHTMLLink();
 70:         $this->_img = new cHTMLImage();
 71:         $this->_img->setBorder(0);
 72:         $this->_img->setStyle("padding-left: 1px; padding-right: 1px;");
 73: 
 74:         $this->_parameters = array();
 75: 
 76:         $this->setEnabled();
 77: 
 78:         cDeprecated("This class is not longer supported.");
 79:     }
 80: 
 81:     /**
 82:      * Sets the action icon for this action.
 83:      *
 84:      * @param string $icon Path to the icon. Relative to the backend, if not
 85:      *        passed as absolute path.
 86:      */
 87:     public function setIcon($icon) {
 88:         $this->_img->setSrc($icon);
 89:     }
 90: 
 91:     /**
 92:      *
 93:      * @return cHTMLImage
 94:      */
 95:     public function getIcon() {
 96:         return $this->_img;
 97:     }
 98: 
 99:     /**
100:      * Sets this class to use a specific action, example "con_makestart".
101:      *
102:      * @param string actionName Name of the action to use. This action must
103:      *        exist in the actions table before
104:      *        using it, otherwise, this method will fail.
105:      */
106:     public function setNamedAction($actionName) {
107:         if ($this->loadBy("name", $actionName) !== false) {
108:             $a = new cApiArea();
109:             $a->loadByPrimaryKey($this->get("idarea"));
110: 
111:             $this->_namedAction = $actionName;
112:             $this->_area = $a->get("name");
113: 
114:             $this->_parameters = array();
115:             $this->_wantParameters = array();
116:         }
117:     }
118: 
119:     /**
120:      */
121:     public function setDisabled() {
122:         $this->_enabled = false;
123:         $this->_onDisable();
124:     }
125: 
126:     /**
127:      */
128:     public function setEnabled() {
129:         $this->_enabled = true;
130:         $this->_onEnable();
131:     }
132: 
133:     /**
134:      */
135:     protected function _onDisable() {
136:     }
137: 
138:     /**
139:      */
140:     protected function _onEnable() {
141:     }
142: 
143:     /**
144:      * Change linked area
145:      */
146:     public function changeArea($sArea) {
147:         $this->_area = $sArea;
148:     }
149: 
150:     /**
151:      *
152:      * @param string $parameter
153:      */
154:     public function wantParameter($parameter) {
155:         $this->_wantParameters[] = $parameter;
156: 
157:         $this->_wantParameters = array_unique($this->_wantParameters);
158:     }
159: 
160:     /**
161:      * sets the help text for this action.
162:      *
163:      * @param string helptext The helptext to apply
164:      */
165:     public function setHelpText($helptext) {
166:         $this->_helpText = $helptext;
167:     }
168: 
169:     /**
170:      */
171:     public function getHelpText() {
172:         return $this->_helpText;
173:     }
174: 
175:     /**
176:      *
177:      * @param string $name
178:      * @param string $value
179:      */
180:     public function setParameter($name, $value) {
181:         $this->_parameters[$name] = $value;
182:     }
183: 
184:     /**
185:      *
186:      * @param mixed $parameters
187:      * @return boolean
188:      */
189:     public function process($parameters) {
190:         echo "Process should be overridden";
191:         return false;
192:     }
193: 
194:     /**
195:      *
196:      * @return string
197:      */
198:     public function render() {
199:         $this->_img->setAlt($this->_helpText);
200: 
201:         foreach ($this->_parameters as $name => $value) {
202:             $this->_link->setCustom($name, $value);
203:         }
204: 
205:         $this->_link->setAlt($this->_helpText);
206:         $this->_link->setCLink($this->_area, $this->_frame, $this->_namedAction);
207:         $this->_link->setTargetFrame($this->_target);
208:         $this->_link->setContent($this->_img);
209: 
210:         if ($this->_enabled == true) {
211:             return ($this->_link->render());
212:         } else {
213:             return ($this->_img->render());
214:         }
215:     }
216: 
217:     /**
218:      *
219:      * @return string
220:      */
221:     public function renderText() {
222:         foreach ($this->_parameters as $name => $value) {
223:             $this->_link->setCustom($name, $value);
224:         }
225: 
226:         $this->_link->setAlt($this->_helpText);
227:         $this->_link->setCLink($this->_area, $this->_frame, $this->_namedAction);
228:         $this->_link->setTargetFrame($this->_target);
229:         $this->_link->setContent($this->_helpText);
230: 
231:         if ($this->_enabled == true) {
232:             return ($this->_link->render());
233:         } else {
234:             return ($this->_helpText);
235:         }
236:     }
237: }
238: 
239: /**
240:  * Clickable question action class.
241:  * @deprecated 2013-11-17 This class is not longer supported.
242:  * @package Core
243:  * @subpackage GUI
244:  */
245: class cApiClickableQuestionAction extends cApiClickableAction {
246: 
247:     /**
248:      */
249:     public function __construct() {
250:         parent::__construct();
251:     }
252: 
253:     /**
254:      *
255:      * @param string $mode
256:      */
257:     public function setQuestionMode($mode) {
258:         $this->_mode = $mode;
259:     }
260: 
261:     /**
262:      *
263:      * @param string $question
264:      */
265:     public function setQuestion($question) {
266:         $this->_question = $question;
267:     }
268: 
269:     /**
270:      *
271:      * @param string $var
272:      */
273:     public function setResultVar($var) {
274:         $this->_resultVar = $var;
275:     }
276: 
277:     /**
278:      * (non-PHPdoc)
279:      *
280:      * @see cApiClickableAction::render()
281:      */
282:     public function render() {
283:         switch ($this->_mode) {
284:             case self::QUESTIONACTION_PROMPT:
285:                 $this->_link->attachEventDefinition("_" . get_class($this) . rand(), "onclick", 'var answer = prompt("' . conHtmlSpecialChars($this->_question) . '");if (answer == null) {return false;} else { this.href = this.href + "&' . $this->_resultVar . '="+answer; return true;}');
286:                 break;
287:             case self::QUESTIONACTION_YESNO:
288:             default:
289:                 $this->_link->attachEventDefinition("_" . get_class($this) . rand(), "onclick", 'var answer = confirm("' . conHtmlSpecialChars($this->_question) . '");if (answer == false) {return false;} else { return true;}');
290:                 break;
291:         }
292: 
293:         return parent::render();
294:     }
295: }
296: 
CMS CONTENIDO 4.9.4 API documentation generated by ApiGen 2.8.0