Exemplo n.º 1
0
 /**
  * generate delete button
  *
  * @staticvar icms_ipf_Controller $controller
  * @return str linked icon to delete the object
  */
 public function getDeleteButtonForDisplay()
 {
     static $controller = null;
     if ($this->getVar('system') == 1) {
         return;
     }
     if ($controller === null) {
         $controller = new icms_ipf_Controller($this->handler);
     }
     return $controller->getDeleteItemLink($this, false, true, false);
 }
Exemplo n.º 2
0
 /**
  *
  *
  * @param	bool	$onlyUrl
  * @param	bool	$withimage
  * @param	bool	$userSide
  */
 public function getDeleteItemLink($onlyUrl = false, $withimage = false, $userSide = false)
 {
     $controller = new icms_ipf_Controller($this->handler);
     return $controller->getDeleteItemLink($this, $onlyUrl, $withimage, $userSide);
 }
Exemplo n.º 3
0
 /**
  * Create a row based on the item and children
  *
  * @param object	$object	@link icms_ipf_Object
  * @param integer	$level	sub-level of the item
  */
 public function createTableRow($object, $level = 0)
 {
     $aObject = array();
     $i = 0;
     $aColumns = array();
     $doWeHaveActions = false;
     foreach ($this->_columns as $column) {
         $aColumn = array();
         if ($i == 0) {
             $class = "head";
         } elseif ($i % 2 == 0) {
             $class = "even";
         } else {
             $class = "odd";
         }
         if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) {
             $method = $column->_customMethodForValue;
             $value = $object->{$method}();
         } else {
             /**
              * If the column is the identifier, then put a link on it
              */
             if ($column->getKeyName() == $this->_objectHandler->identifierName) {
                 $value = $object->getItemLink();
             } else {
                 $value = $object->getVar($column->getKeyName());
             }
         }
         $space = '';
         if ($column->getKeyName() == $this->_objectHandler->identifierName) {
             for ($i = 0; $i < $level; $i++) {
                 $space = $space . '--';
             }
         }
         if ($space != '') {
             $space .= '&nbsp;';
         }
         $aColumn['value'] = $space . $value;
         $aColumn['class'] = $class;
         $aColumn['width'] = $column->getWidth();
         $aColumn['align'] = $column->getAlign();
         $aColumn['key'] = $column->getKeyName();
         $aColumns[] = $aColumn;
         $i++;
     }
     $aObject['columns'] = $aColumns;
     $class = $class == 'even' ? 'odd' : 'even';
     $aObject['class'] = $class;
     $actions = array();
     // Adding the custom actions if any
     foreach ($this->_custom_actions as $action) {
         if (method_exists($object, $action)) {
             $actions[] = $object->{$action}();
         }
     }
     $controller = new icms_ipf_Controller($this->_objectHandler);
     if (in_array('edit', $this->_actions)) {
         $actions[] = $controller->getEditItemLink($object, false, true);
     }
     if (in_array('delete', $this->_actions)) {
         $actions[] = $controller->getDeleteItemLink($object, false, true);
     }
     $aObject['actions'] = $actions;
     $this->_tpl->assign('icms_actions_column_width', count($actions) * 30);
     $aObject['id'] = $object->id();
     $this->_aObjects[] = $aObject;
     $childrenObjects = $this->getChildrenOf($object->id());
     $this->_hasActions = $this->_hasActions ? true : count($actions) > 0;
     if ($childrenObjects) {
         $level++;
         foreach ($childrenObjects as $subObject) {
             $this->createTableRow($subObject, $level);
         }
     }
 }
Exemplo n.º 4
0
	/**
	 * Determine if the user can delete the task and display a button
	 * @return	mixed
	 */
	public function getDeleteButtonForDisplay() {
		static $controller = NULL;
		if ($this->getType(0) == 'addon') return;
		if ($controller === NULL) $controller = new icms_ipf_Controller($this->handler);
		return $controller->getDeleteItemLink($this, FALSE, TRUE, FALSE);
	}