Esempio n. 1
0
 public function tearDown()
 {
     parent::tearDown();
     if (is_object($this->model)) {
         $this->model->dropTable();
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 /**
  * @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();
 }
Esempio n. 4
0
 public function __construct($initialData, JobRepository $repository)
 {
     $this->repository = $repository;
     if (empty($initialData)) {
         $initialData['dateCreated'] = date('Y-m-d H:i:s');
     }
     parent::__construct($initialData);
 }
Esempio n. 5
0
 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();
     }
 }
Esempio n. 6
0
 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();
     }
 }
Esempio n. 7
0
 /**
  *   Удаляет учетную запись
  * @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);
 }
Esempio n. 8
0
 public function __construct(array $initialData, ConfigurationRepository $configurationRepository)
 {
     $this->configurationRepository = $configurationRepository;
     parent::__construct($initialData);
 }
Esempio n. 9
0
 public function __construct(array $initialData, $columnName, $columnFieldInfo)
 {
     $this->columnName = $columnName;
     $this->columnFieldInfo = $columnFieldInfo;
     parent::__construct($initialData);
 }
Esempio n. 10
0
 /**
  * (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();
 }
Esempio n. 11
0
 public function __construct($documentData = array())
 {
     parent::__construct($documentData);
     $this->items = new ItemList();
 }
Esempio n. 12
0
 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);
 }
Esempio n. 13
0
 public function getAdminInsertForm()
 {
     parent::getAdminInsertForm();
 }