/**
  * Loads an array of typed objects of a given class (same class as current object by default)
  *
  * @param  string $class [optional] class name
  * @param  string $key [optional] key name in db to use as key of array
  * @param  array  $additionalVars [optional] array of string additional key names to add as vars to object
  * @return array  of objects of the same class (empty array if no objects)
  */
 public function &loadTrueObjects($class = null, $key = '', $additionalVars = null)
 {
     if ($additionalVars === null) {
         $additionalVars = array();
     }
     /** @var $objectsArray cbpaidTable[] */
     $objectsArray = parent::loadTrueObjects($class, $key, $additionalVars);
     foreach ($objectsArray as $k => $v) {
         $objectsArray[$k]->_historyLogPrevious();
     }
     return $objectsArray;
 }
 /**
  *	Delete method for fields deleting also fieldvalues, but not the data column in the comprofiler table.
  *	For that, deleteDataDescr() method must be called instead.
  *
  *	@param id of row to delete
  *	@return true if successful otherwise returns and error message
  */
 function delete($oid = null)
 {
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = (int) $oid;
     }
     $result = true;
     //Find all fieldValues related to the field
     $this->_db->setQuery("SELECT `fieldvalueid` FROM #__comprofiler_field_values WHERE `fieldid`=" . (int) $this->{$k});
     $fieldvalues = $this->_db->loadObjectList();
     $rowFieldValues = new moscomprofilerFieldValues($this->_db);
     if (count($fieldvalues) > 0) {
         //delete each field value related to a field
         foreach ($fieldvalues as $fieldvalue) {
             $result = $rowFieldValues->delete($fieldvalue->fieldvalueid) && $result;
         }
     }
     //Now delete the field itself without deleting the user data, preserving it for reinstall
     //$this->deleteColumn( $this->table, $this->name );	// this would delete the user data
     $result = parent::delete($this->{$k}) && $result;
     return $result;
 }
Exemplo n.º 3
0
	public function storeOrder( $order ) {
		global $_CB_framework, $_PLUGINS;

		$plugin	=	cbgjClass::getPlugin();
		$user	=&	CBuser::getUserDataInstance( $_CB_framework->myId() );

		$_PLUGINS->trigger( 'gjint_onBeforeUpdateAutoOrder', array( &$order, &$this, $user, $plugin ) );

		$this->set( 'ordering', (int) $order );

		if ( ! parent::store() ) {
			return false;
		}

		$_PLUGINS->trigger( 'gjint_onAfterUpdateAutoOrder', array( $this->get( 'ordering' ), $this, $user, $plugin ) );

		$this->updateOrder();

		return true;
	}
Exemplo n.º 4
0
	/**
	 * stores notification params to database
	 *
	 * @param mixed $params
	 * @param boolean $html
	 * @return boolean
	 */
	public function storeParams( $params, $html = true ) {
		global $_CB_framework, $_PLUGINS;

		$plugin	=	cbgjClass::getPlugin();
		$user	=&	CBuser::getUserDataInstance( $_CB_framework->myId() );
		$params	=	cbgjClass::parseParams( $params, $html, $this->getParams( $html ) );

		$_PLUGINS->trigger( 'gj_onBeforeUpdateNotificationParams', array( &$params, &$this, $this->getGroup(), $this->getCategory(), $user, $plugin ) );

		$this->set( 'params', trim( $params->toIniString() ) );

		if ( ! parent::store() ) {
			return false;
		}

		$_PLUGINS->trigger( 'gj_onAfterUpdateNotificationParams', array( $params, $this, $this->getGroup(), $this->getCategory(), $user, $plugin ) );

		return true;
	}