public function delete() { parent::$__object = "Alias"; parent::$__table = "pcms_alias"; if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_ALIAS, $this->getId(), $this->getAlias(), "delete"); } return parent::delete(); }
public function save($blnSaveModifiedDate = TRUE) { self::$object = "Setting"; self::$table = "pcms_setting"; $blnReturn = parent::save($blnSaveModifiedDate); $objSettingTemplate = SettingTemplate::selectByPk($this->getSettingId()); if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_SETTING, $this->getId(), $objSettingTemplate->getName(), "edit", $this->getValue()); } return $blnReturn; }
public function delete() { global $_CONF, $_PATHS; parent::$__object = "Feed"; parent::$__table = "pcms_feed"; $objElementFeeds = ElementFeed::selectByFeed($this->getId()); foreach ($objElementFeeds as $objElementFeed) { $objElement = Element::selectByPK($objElementFeed->getElementId()); //*** Remove dynamic element. $objElement->delete(); } //*** Remove cached feed. @unlink($_PATHS['upload'] . $this->getHash()); if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_FEED, $this->getId(), $this->getFeed(), "delete"); } return parent::delete(); }
public function duplicate($strNewName = "") { global $objLang, $_CONF, $objLiveUser; if ($this->id > 0) { //*** Cache the name of the current template. $strName = $this->name; if (!empty($strNewName)) { //*** Set the name of the duplicate template. $this->name = sprintf($strNewName, $strName); } //*** Duplicate the template. $objReturn = parent::duplicate(); if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_TEMPLATE, $this->getId(), $strName, "duplicate", $objReturn->getId()); } if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_TEMPLATE, $objReturn->getId(), $objReturn->getName(), "create"); } //*** Reset the name of the current template. $this->name = $strName; //*** Duplicate the fields of the current template. $objFields = $this->getFields(); foreach ($objFields as $objField) { $objNewField = $objField->duplicate(); $objNewField->setTemplateId($objReturn->getId()); $objNewField->setUsername($objLiveUser->getProperty("name")); $objNewField->save(); } //*** Copy any child templates to the duplicate. $strSql = sprintf("SELECT * FROM pcms_template WHERE parentId = '%s' AND accountId = '%s'", $this->id, $_CONF['app']['account']->getId()); $objTemplates = Template::select($strSql); foreach ($objTemplates as $objTemplate) { $objTemplate->copy($objReturn->getId()); } return $objReturn; } return NULL; }
public function duplicate($strNewName = "") { global $objLang, $_CONF; if ($this->id > 0) { //*** Cache the name of the current element. $strName = $this->name; if (!empty($strNewName)) { //*** Set the name of the duplicate element. $this->name = sprintf($strNewName, $strName); } //*** Duplicate the element. $objReturn = parent::duplicate(); if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_STORAGE, $this->getId(), $strName, "duplicate", $objReturn->getId()); } if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_STORAGE, $objReturn->getId(), $objReturn->getName(), "create"); } //*** Reset the name of the current element. $this->name = $strName; //*** Copy any child elements to the duplicate. $strSql = sprintf("SELECT * FROM pcms_storage_item WHERE parentId = '%s' AND accountId = '%s'", $this->id, $_CONF['app']['account']->getId()); $objElements = StorageItem::select($strSql); foreach ($objElements as $objElement) { $objElement->copy($objReturn->getId()); } return $objReturn; } return NULL; }
public function delete() { self::$object = "TemplateField"; self::$table = "pcms_template_field"; if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_TEMPLATEFIELD, $this->getId(), $this->getName(), "delete", $this->getTemplateId()); } $objElementField = ElementField::deleteByTemplateId($this->id); return parent::delete(); }
public function duplicate($strNewName = "") { global $objLang, $_CONF, $objLiveUser; if ($this->id > 0) { //*** Cache the name of the current element. $strName = $this->name; if (!empty($strNewName)) { //*** Set the name of the duplicate element. $this->name = sprintf($strNewName, $strName); } //*** Duplicate the element. $objReturn = parent::duplicate(); if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_ELEMENT, $this->getId(), $strName, "duplicate", $objReturn->getId()); } if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_ELEMENT, $objReturn->getId(), $objReturn->getName(), "create"); } //*** Reset the name of the current element. $this->name = $strName; //*** Duplicate the fields of the current element. $objFields = $this->getFields(); foreach ($objFields as $objField) { $objNewField = $objField->duplicate(); $objNewField->setElementId($objReturn->getId()); $objNewField->setUsername($objLiveUser->getProperty("name")); $objNewField->save(); $objNewField->setValue($objField->getValue()); } //*** Copy any child elements to the duplicate. $strSql = sprintf("SELECT * FROM pcms_element WHERE parentId = '%s' AND accountId = '%s'", $this->id, $_CONF['app']['account']->getId()); $objElements = Element::select($strSql); foreach ($objElements as $objElement) { $objElement->copy($objReturn->getId()); } //*** Save permissions. $objTemp = $this->getPermissions(); $objTemp->setElementId($objReturn->getId()); $objTemp->save(); //*** Save language properties. $objTemps = $this->getLanguageActives(); foreach ($objTemps as $key => $value) { $objReturn->setLanguageActive($value, TRUE); } //*** Save schedule information. $objTemp = $this->getSchedule(); $objTemp->id = 0; $objReturn->setSchedule($objTemp); return $objReturn; } return NULL; }
public function delete() { global $_CONF; self::$__object = "ContentLanguage"; self::$__table = "pcms_language"; //*** Remove all field values for this language. $objElements = Element::select(); foreach ($objElements as $objElement) { $objFields = $objElement->getFields(); foreach ($objFields as $objField) { $objValue = $objField->getValueObject($this->id); $objValue->delete(); } } //*** Remove all elements linked to this language. ElementLanguage::deleteByLanguage($this->getId()); if (class_exists("AuditLog")) { AuditLog::addLog(AUDIT_TYPE_LANGUAGE, $this->getId(), $this->getName(), "delete"); } return parent::delete(); }