示例#1
0
 /** {@inheritDoc} */
 public function initialize()
 {
     if (!$this->modx->hasPermission($this->permission)) {
         return $this->modx->lexicon('access_denied');
     }
     return parent::initialize();
 }
示例#2
0
 public function initialize()
 {
     if (!$this->getProperty($this->primaryKeyField)) {
         return $this->modx->lexicon($this->objectType . '_type_err_ns');
     }
     return parent::initialize();
 }
示例#3
0
 /** {@inheritDoc} */
 public function outputArray(array $array, $count = false)
 {
     if ($this->getProperty('addall')) {
         $array = array_merge_recursive(array(array('name' => $this->modx->lexicon('gl_all'), 'value' => '')), $array);
     }
     return parent::outputArray($array, $count);
 }
示例#4
0
 /** {@inheritDoc} */
 public function initialize()
 {
     /** @var gl $gl */
     $this->gl = $this->modx->getService('gl');
     $this->gl->initialize($this->getProperty('context', $this->modx->context->key));
     return parent::initialize();
 }
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $this->formId = (int) $this->getProperty('form');
     $this->threadId = (int) $this->getProperty('thread');
     $this->fields = $this->getProperty('fields');
     if (empty($this->formId)) {
         $this->modx->error->addField('form', $this->modx->lexicon('voteforms_err_form'));
     }
     if (empty($this->fields)) {
         $this->modx->error->addField('fields', $this->modx->lexicon('voteforms_err_fields'));
     }
     if (empty($this->threadId)) {
         $this->modx->error->addField('thread', $this->modx->lexicon('voteforms_err_thread'));
     }
     $this->form = $this->modx->getObject('VoteForm', $this->formId);
     if (!$this->form->active) {
         return $this->modx->lexicon('voteforms_record_err_active');
     }
     // validation rating_max
     $ratingMax = $this->form->rating_max;
     foreach ($this->fields as $key => $field) {
         if ((int) $field['value'] > (int) $ratingMax) {
             return $this->modx->lexicon('voteforms_form_err_rating_max_value');
         }
     }
     return parent::initialize();
 }
示例#6
0
 /** {@inheritDoc} */
 public function initialize()
 {
     /** @var slackin $slackin */
     $this->slackin = $this->modx->getService('slackin');
     $this->slackin->initialize($this->getProperty('context', $this->modx->context->key));
     return parent::initialize();
 }
示例#7
0
 public function initialize()
 {
     $album = $this->getProperty('album', false);
     if (empty($album)) {
         return $this->modx->lexicon('gallery.album_err_ns');
     }
     return parent::initialize();
 }
示例#8
0
 public function initialize()
 {
     $data = $this->getProperty('data');
     if (empty($data)) {
         return $this->modx->lexicon('invalid_data');
     }
     $this->data = is_array($data) ? $data : $this->modx->fromJSON(urldecode($data));
     return parent::initialize();
 }
示例#9
0
 /** {@inheritDoc} */
 public function outputArray(array $array, $count = false)
 {
     //		if ($this->getProperty('addall')) {
     //			$array = array_merge_recursive(array(array(
     //				'name' => $this->modx->lexicon('mlmsystem_all'),
     //				'value' => ''
     //			)), $array);
     //		}
     return parent::outputArray($array, $count);
 }
示例#10
0
 public function initialize()
 {
     $id = $this->getProperty('id');
     if (empty($id)) {
         return $this->modx->lexicon('quip.comment_err_ns');
     }
     $this->comment = $this->modx->getObject($this->classKey, $id);
     if (empty($this->comment)) {
         return $this->modx->lexicon('quip.comment_err_nf');
     }
     return parent::initialize();
 }
示例#11
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $subject = $this->getProperty('subject');
     if (empty($subject)) {
         return $this->modx->lexicon($this->objectType . '_err_not_specified_subject');
     }
     $this->type = $this->getProperty('type', 'user');
     $error = $this->prepareRecipientsByType();
     if ($error !== false) {
         return $error;
     }
     return parent::initialize();
 }
示例#12
0
 public function initialize()
 {
     $initialized = parent::initialize();
     $id = $this->getProperty('id', null);
     if (empty($id)) {
         return $this->modx->lexicon('articles.articles_err_ns');
     }
     $this->object = $this->modx->getObject('Article', $id);
     if (empty($this->object)) {
         return $this->modx->lexicon('articles.article_err_nf');
     }
     return $initialized;
 }
示例#13
0
 public function initialize()
 {
     $thread = $this->getProperty('thread');
     if (empty($thread)) {
         return $this->modx->lexicon('quip.thread_err_ns');
     }
     $this->thread = $this->modx->getObject($this->classKey, $thread);
     if (empty($this->thread)) {
         return $this->modx->lexicon('quip.thread_err_nf');
     }
     if (!$this->thread->checkPolicy('truncate')) {
         return $this->modx->lexicon('access_denied');
     }
     return parent::initialize();
 }
示例#14
0
 /**
  * {@inheritdoc}
  * @return bool|null|string
  */
 public function initialize()
 {
     $isSetExists = $this->getPropertySet($propertySetId);
     if ($isSetExists !== true) {
         return $isSetExists;
     }
     $isElementExists = $this->getElement();
     if ($isElementExists !== true) {
         return $isElementExists;
     }
     $this->setProperty($this->propertySetKey, $propertySetId);
     $this->unsetProperty('propertyset');
     $this->unsetProperty('action');
     $this->object = $this->modx->newObject($this->classKey);
     return parent::initialize();
 }
 /**
  * {@inheritDoc}
  * 
  * @return mixed
  */
 public function initialize()
 {
     $data = $this->getProperty('data');
     if (empty($data)) {
         return $this->modx->lexicon('invalid_data');
     }
     $data = $this->modx->fromJSON($data);
     if (empty($data)) {
         return $this->modx->lexicon('invalid_data');
     }
     if (empty($data['id'])) {
         return $this->failure($this->modx->lexicon('resource_group_err_ns'));
     }
     $this->setProperties($data);
     $this->unsetProperty('data');
     return parent::initialize();
 }
示例#16
0
 public function initialize()
 {
     $file = $this->getProperty($this->fileProperty);
     if (empty($file) || !isset($file['tmp_name'])) {
         return $this->modx->lexicon('import_err_upload');
     }
     if ($file['error'] != 0) {
         return $this->modx->lexicon('import_err_upload');
     }
     if (!file_exists($file['tmp_name'])) {
         return $this->modx->lexicon('import_err_upload');
     }
     $this->xml = file_get_contents($file['tmp_name']);
     if (empty($this->xml)) {
         return $this->modx->lexicon('import_err_upload');
     }
     if (!function_exists('simplexml_load_string')) {
         return $this->failure($this->modx->lexicon('simplexml_err_nf'));
     }
     return parent::initialize();
 }
示例#17
0
 public function initialize()
 {
     $this->setDefaultProperties(array('includeTVs' => false, "thread_id" => null, "listType" => "tree"));
     return parent::initialize();
 }
示例#18
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function initialize()
 {
     $this->setDefaultProperties(array('start' => 0, 'limit' => 0, 'sort' => $this->defaultSortField, 'dir' => $this->defaultSortDirection, 'combo' => true, 'query' => ''));
     return parent::initialize();
 }