public function tearDown() { parent::tearDown(); if (is_object($this->model)) { $this->model->dropTable(); } }
protected function autoCreate() { $modelClass = $this->fieldInfo['model']; if (empty($this->aValue)) { $this->linkedModel = new $modelClass(); $this->linkedModel->insert(); } else { $this->linkedModel = call_user_func([$modelClass, 'getById'], $this->aValue); } }
/** * @param $path * @param $type * @param $szField */ public function show($path, $type, $szField) { $design = CMSDesign::getInstance(); // $path = stripslashes($path); $type = stripslashes($type); $szField = stripslashes($szField); $modelName = \Extasy\Model\Model::isModel($type); $fields = call_user_func($modelName, 'getFieldsInfo'); $aInfo = @getimagesize(\Extasy\CMS::getFilesPath() . ${$fields}[$szField]['base_dir'] . $path); $szFilename = \Extasy\CMS::getFilesHttpRoot() . $fields[$szField]['base_dir'] . $path; $x = '?' . rand(0, 1000000); if (isset($aInfo[2])) { $aParse['szFilename'] = $szFilename; } $design->popupBegin(); $design->popupHeader('Просмотр изображения'); $design->formBegin(); $design->br(); if (!empty($szFilename)) { print '<img src="' . $szFilename . $x . '">'; } $design->popupEnd(); $this->output(); }
public function __construct($initialData, JobRepository $repository) { $this->repository = $repository; if (empty($initialData)) { $initialData['dateCreated'] = date('Y-m-d H:i:s'); } parent::__construct($initialData); }
public function insert() { $condition = array('class' => $this->class->getValue(), 'hash' => $this->hash->getValue(), 'status' => self::NewStatus); $found = DBSimple::get(self::TableName, $condition); if (!empty($found)) { $this->setData($found); } else { parent::insert(); } }
public function insert() { parent::insert(); if (empty($this->log)) { if (!$this->log_id->getValue()) { throw new \NotFoundException('Log record not set. Record can`t be added '); } $this->log = new Log(); $this->log->get($this->log_id->getValue()); } if ($this->log->critical->getValue()) { $this->sendEmailNotification(); } }
/** * Удаляет учетную запись * @return */ public function delete() { $data = UsersDBManager::get($this->id->getValue()); if (!empty($data['persistent'])) { return; } $granted = EventController::callFilter('users_account_before_delete', $this); // if granted then call standart removing if (!empty($granted)) { parent::delete($granted); } else { return; } EventController::callEvent('users_account_after_delete', $this); }
public function __construct(array $initialData, ConfigurationRepository $configurationRepository) { $this->configurationRepository = $configurationRepository; parent::__construct($initialData); }
public function __construct(array $initialData, $columnName, $columnFieldInfo) { $this->columnName = $columnName; $this->columnFieldInfo = $columnFieldInfo; parent::__construct($initialData); }
/** * (non-PHPdoc) * @see adminPage::output() */ public function output(extasyDocument $doc = null, $szTitle = '', $bEdit = true) { if (!empty($this->typeInfo['edit_fields'])) { $design = CMSDesign::getInstance(); $design->begin($this->viewBeginPath, $szTitle); $design->documentBegin(); $design->header($szTitle); $design->formBegin(); $design->hidden('typeName', $this->modelName); if ($bEdit) { $design->hidden('id', $doc->id); $design->submit('submit', _msg('Сохранить')); } else { $design->submit('submit', _msg('Добавить')); } $design->tableBegin(); $fieldList = explode(',', $this->typeInfo['edit_fields']); foreach ($fieldList as $fieldName) { $title = !empty($this->typeInfo['fields'][$fieldName]['title']) ? $this->typeInfo['fields'][$fieldName]['title'] : $fieldName; $help = !empty($this->typeInfo['fields'][$fieldName]['cms_help']) ? $this->typeInfo['fields'][$fieldName]['cms_help'] : ''; $design->row2cell($title, $doc->attr($fieldName, true)->getAdminFormValue(), $help); } $design->TableEnd(); foreach ($this->aBackUrlParams as $key => $row) { $design->hidden($key, htmlspecialchars($row)); } if ($bEdit) { $design->submit('submit', _msg('Сохранить')); } else { $design->submit('submit', _msg('Добавить')); } $design->formEnd(); $design->documentEnd(); $design->end(); } else { if ($bEdit) { $doc->getAdminUpdateForm(); } else { $doc->getAdminInsertForm(); } } parent::output(); }
public function __construct($documentData = array()) { parent::__construct($documentData); $this->items = new ItemList(); }
public function createDatabaseTable($dropTable = false) { parent::createDatabaseTable($dropTable); $sql = sprintf('alter table %s add index `login_status` (`user_id`, `status`)', self::TableName); DB::post($sql); }
public function getAdminInsertForm() { parent::getAdminInsertForm(); }