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
    • NavigationMain
    • 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
  • cGuiFoldingRow
  • cGuiList
  • cGuiMenu
  • cGuiNavigation
  • cGuiNotification
  • cGuiObjectPager
  • cGuiPage
  • cGuiScrollList
  • 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 class.
  4:  *
  5:  * @package    Core
  6:  * @subpackage GUI
  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:  * cApiClickableAction is a subclass of cApiAction.
 20:  * It provides an image for visual
 21:  * representation. Inherited classes should call the "setNamedAction" operation
 22:  * in
 23:  * their constructors; on-the-fly-implementations should call it directly after
 24:  * creating an object instance.
 25:  *
 26:  * @package    Core
 27:  * @subpackage GUI
 28:  */
 29: class cApiClickableAction extends cApiAction {
 30: 
 31:     /**
 32:      * * Attributes: **
 33:      */
 34: 
 35:     /**
 36:      * Help text
 37:      *
 38:      * @access private
 39:      */
 40:     private $_helpText;
 41: 
 42:     /**
 43:      * cHTMLLink for rendering the icon
 44:      *
 45:      * @access private
 46:      */
 47:     protected $_link;
 48: 
 49:     /**
 50:      * cHTMLImage for rendering the icon
 51:      *
 52:      * @access private
 53:      */
 54:     private $_img;
 55: 
 56:     const QUESTIONACTION_PROMPT = 'prompt';
 57: 
 58:     const QUESTIONACTION_YESNO = 'yesno';
 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: 
 79:     /**
 80:      * Sets the action icon for this action.
 81:      *
 82:      * @param string icon Path to the icon. Relative to the backend, if not
 83:      *            passed as absolute path.
 84:      * @return void
 85:      */
 86:     public function setIcon($icon) {
 87:         $this->_img->setSrc($icon);
 88:     }
 89: 
 90:     public function getIcon() {
 91:         return $this->_img;
 92:     }
 93: 
 94:     /**
 95:      * Sets this class to use a specific action, example "con_makestart".
 96:      *
 97:      * @param string actionName Name of the action to use. This action must
 98:      *            exist in the actions table before
 99:      *        using it, otherwise, this method will fail.
100:      * @return void
101:      */
102:     public function setNamedAction($actionName) {
103:         if ($this->loadBy("name", $actionName) !== false) {
104:             $a = new cApiArea();
105:             $a->loadByPrimaryKey($this->get("idarea"));
106: 
107:             $this->_namedAction = $actionName;
108:             $this->_area = $a->get("name");
109: 
110:             $this->_parameters = array();
111:             $this->_wantParameters = array();
112:         }
113:     }
114: 
115:     public function setDisabled() {
116:         $this->_enabled = false;
117:         $this->_onDisable();
118:     }
119: 
120:     public function setEnabled() {
121:         $this->_enabled = true;
122:         $this->_onEnable();
123:     }
124: 
125:     protected function _onDisable() {
126:     }
127: 
128:     protected function _onEnable() {
129:     }
130: 
131:     /**
132:      * Change linked area
133:      */
134:     public function changeArea($sArea) {
135:         $this->_area = $sArea;
136:     }
137: 
138:     public function wantParameter($parameter) {
139:         $this->_wantParameters[] = $parameter;
140: 
141:         $this->_wantParameters = array_unique($this->_wantParameters);
142:     }
143: 
144:     /**
145:      * sets the help text for this action.
146:      *
147:      * @param string helptext The helptext to apply
148:      * @return void
149:      */
150:     public function setHelpText($helptext) {
151:         $this->_helpText = $helptext;
152:     }
153: 
154:     public function getHelpText() {
155:         return $this->_helpText;
156:     }
157: 
158:     public function setParameter($name, $value) {
159:         $this->_parameters[$name] = $value;
160:     }
161: 
162:     public function process($parameters) {
163:         echo "Process should be overridden";
164:         return false;
165:     }
166: 
167:     public function render() {
168:         $this->_img->setAlt($this->_helpText);
169: 
170:         foreach ($this->_parameters as $name => $value) {
171:             $this->_link->setCustom($name, $value);
172:         }
173: 
174:         $this->_link->setAlt($this->_helpText);
175:         $this->_link->setCLink($this->_area, $this->_frame, $this->_namedAction);
176:         $this->_link->setTargetFrame($this->_target);
177:         $this->_link->setContent($this->_img);
178: 
179:         if ($this->_enabled == true) {
180:             return ($this->_link->render());
181:         } else {
182:             return ($this->_img->render());
183:         }
184:     }
185: 
186:     public function renderText() {
187:         foreach ($this->_parameters as $name => $value) {
188:             $this->_link->setCustom($name, $value);
189:         }
190: 
191:         $this->_link->setAlt($this->_helpText);
192:         $this->_link->setCLink($this->_area, $this->_frame, $this->_namedAction);
193:         $this->_link->setTargetFrame($this->_target);
194:         $this->_link->setContent($this->_helpText);
195: 
196:         if ($this->_enabled == true) {
197:             return ($this->_link->render());
198:         } else {
199:             return ($this->_helpText);
200:         }
201:     }
202: 
203: }
204: 
205: /**
206:  * Clickable question action class.
207:  *
208:  * @package    Core
209:  * @subpackage GUI
210:  */
211: class cApiClickableQuestionAction extends cApiClickableAction {
212: 
213:     public function __construct() {
214:         parent::__construct();
215:     }
216: 
217:     public function setQuestionMode($mode) {
218:         $this->_mode = $mode;
219:     }
220: 
221:     public function setQuestion($question) {
222:         $this->_question = $question;
223:     }
224: 
225:     public function setResultVar($var) {
226:         $this->_resultVar = $var;
227:     }
228: 
229:     public function render() {
230:         switch ($this->_mode) {
231:             case self::QUESTIONACTION_PROMPT:
232:                 $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;}');
233:                 break;
234:             case self::QUESTIONACTION_YESNO:
235:             default:
236:                 $this->_link->attachEventDefinition("_" . get_class($this) . rand(), "onclick", 'var answer = confirm("' . conHtmlSpecialChars($this->_question) . '");if (answer == false) {return false;} else { return true;}');
237:                 break;
238:         }
239: 
240:         return parent::render();
241:     }
242: 
243: }
244: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0