Example #1
0
 public function delete()
 {
     if ($this->image) {
         @unlink($this->getImageRealPath());
     }
     $childPages = PageManager::getInstance()->getByPageParentId($this->getPk());
     foreach ($childPages as $childPage) {
         $childPage->page_parent_id = 0;
         $childPage->save();
     }
     return parent::delete();
 }
 public function save($isLogging = true)
 {
     $isNew = $this->isNew();
     $res = parent::save($isLogging);
     if ($res && $isNew) {
         $this->doSendEmail();
     }
     return $res;
 }
Example #3
0
 public function delete()
 {
     $this->addField('oldImage', 'string', $this->image);
     $this->deleteImage();
     return parent::delete();
 }
 function __construct()
 {
     $this->currentEntity = __CLASS__;
     parent::__construct(fvSite::$fvConfig->get("entities.{$this->currentEntity}.fields"), fvSite::$fvConfig->get("entities.{$this->currentEntity}.table_name"), fvSite::$fvConfig->get("entities.{$this->currentEntity}.primary_key", "id"));
 }
 /**
  * Удаление
  * @author Nesterenko Nikita
  * @since 2011/08/25
  * @return bool
  */
 public function delete()
 {
     $this->addField('oldFile', 'string', $this->file);
     $this->addField('oldIcon', 'string', $this->icon);
     $this->deleteFile();
     $this->deleteIcon();
     return parent::delete();
 }
 public function massUpdate($where, $updateFields)
 {
     $o = clone $this->rootObj;
     foreach ($updateFields as $field => $value) {
         $o[$field] = $value;
     }
     $insertList = array();
     foreach ($o->getFieldList() as $field) {
         if ($o->isChanged($field) || $o->autoValue($field, $saveType)) {
             if (in_array($o->getFieldType($field), fvRoot::getSerializedTypes())) {
                 $insertList[$field] = serialize($o->get($field));
             } else {
                 $insertList[$field] = $o->get($field);
             }
         }
     }
     try {
         $dbResult = fvSite::$DB->autoExecute($o->getTableName(), $insertList, DB_AUTOQUERY_UPDATE, $where);
     } catch (Exception $e) {
         var_dump($e->getMessage());
     }
     if (DB::isError($dbResult)) {
         throw new EDatabaseError($dbResult->getMessage());
     }
     return true;
 }
 public function getDelete(fvRoot $inst)
 {
     $html = '<a href="javascript: void(0);" onclick="if(confirm(\'Вы действительно желаете удалить элемент?\')) go(\'' . fvSite::$fvConfig->get('dir_web_root') . $this->moduleName . '/delete/?id=' . $inst->getPk() . '\'); return false;">
                     <img src="' . fvSite::$fvConfig->get('dir_web_root') . 'img/delete_icon.png" title="удалить" width="16" height="16">
              </a>';
     return $html;
 }
 function __construct($fields, $tableName, $keyName = "id")
 {
     parent::__construct($fields, $tableName, $keyName);
 }
Example #9
0
 public function save($isLogging = true)
 {
     $this->set("meta_id", $this->getMeta()->getPk());
     return parent::save($isLogging);
 }