예제 #1
0
 public function prepareRow(xPDOObject $object)
 {
     $object->set('encrypted', 0);
     $object->set('values', $this->modx->toJSON($object->decrypt()));
     $object->save();
     $ff = $object->toArray();
     return $ff;
 }
예제 #2
0
 public function prepareRow(xPDOObject $object)
 {
     $object->set('encrypted', 1);
     $values = $object->get('values');
     $object->set('values', $object->encrypt($values));
     $object->save();
     $ff = $object->toArray();
     return $ff;
 }
예제 #3
0
 public function prepareRow(xPDOObject $object)
 {
     $groupId = $object->get('group');
     if ($groupId) {
         $getGroup = $this->modx->getObject('modxMinifyGroup', $groupId);
         if ($getGroup) {
             $groupName = $getGroup->get('name');
             $object->set('group_name', $groupName);
         }
     }
     $lastmodified = filemtime($this->modx->getOption('base_path') . $object->get('filename'));
     $object->set('last_modified', date('Y-m-d H:i:s', $lastmodified));
     return parent::prepareRow($object);
 }
 /**
  * Overrides xPDOObject::set. Checks if signature is set, and if so,
  * parses it and sets the source if is a new package.
  *
  * @param string $k The key to set
  * @param mixed $v The value to set
  * @param string $vType The validation type to set against
  * @return boolean True if successfully set
  */
 public function set($k, $v= null, $vType= '') {
     $set = parent :: set($k, $v, $vType);
     if ($k == 'signature') {
         $this->parseSignature();
         if ($this->_new && !$this->get('source')) {
             $this->set('source', $this->get('signature') . '.transport.zip');
         }
     }
     return $set;
 }
예제 #5
0
 public function prepareRow(xPDOObject $object)
 {
     $object->set('startymd', date('Y-m-d', $object->get('start')));
     $object->set('starthis', date('g:i A', $object->get('start')));
     $object->set('endymd', date('Y-m-d', $object->get('end')));
     $object->set('endhis', date('g:i A', $object->get('end')));
     $object->set('startRAW', $object->get('start'));
     $object->set('start', date('Y-m-d g:i A', $object->get('start')));
     $object->set('end', date('Y-m-d g:i A', $object->get('end')));
     $object->set('ad', $object->get('ad') == 1 ? true : false);
     return $object->toArray();
 }
예제 #6
0
 public function prepareRow(xPDOObject $object)
 {
     if ($tmp = $this->modx->getObject('modUser', $object->get('uid'))) {
         $user = $tmp->getOne('Profile')->get('fullname');
         if (empty($user)) {
             $user = $tmp->get('username');
         }
         $object->set('username', $user);
     }
     if ($tmp = $this->modx->getObject('mpStatus', $object->get('status'))) {
         $status = '<span style="color:#' . $tmp->get('color') . ';">' . $tmp->get('name') . '</span>';
         $object->set('statusname', $status);
     }
     if ($tmp = $this->modx->getObject('mpMethod', $object->get('method'))) {
         $method = $tmp->get('name');
         $object->set('methodname', $method);
     }
     $array = $object->toArray();
     return $array;
 }
예제 #7
0
 /**
  * @param xPDOObject|modTransportPackage $object
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     if ($object->get('installed') == '0000-00-00 00:00:00') {
         $object->set('installed', null);
     }
     $packageArray = $object->toArray();
     $packageArray = $this->getVersionInfo($packageArray);
     $packageArray = $this->formatDates($packageArray);
     $packageArray['iconaction'] = empty($packageArray['installed']) ? 'icon-install' : 'icon-uninstall';
     $packageArray['textaction'] = empty($packageArray['installed']) ? $this->modx->lexicon('install') : $this->modx->lexicon('uninstall');
     $packageArray = $this->getPackageMeta($object, $packageArray);
     $packageArray = $this->checkForUpdates($object, $packageArray);
     return $packageArray;
 }
예제 #8
0
 /**
  * @param xPDOObject|modTransportPackage $object
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     if ($object->get('installed') == '0000-00-00 00:00:00') {
         $object->set('installed', null);
     }
     $packageArray = $object->toArray();
     $packageArray = $this->parseVersion($object, $packageArray);
     $packageArray = $this->formatDates($object, $packageArray);
     $packageArray = $this->getMetaData($object, $packageArray);
     $packageArray = $this->prepareMenu($object, $packageArray);
     /* setup description, using either metadata or readme */
     if ($object->get('installed') == null) {
         $this->currentIndex--;
     }
     return $packageArray;
 }
예제 #9
0
 public function set($k, $v = null, $vType = '')
 {
     switch ($this->_getPHPType($k)) {
         case 'int':
         case 'integer':
         case 'boolean':
             $v = (int) $v;
             break;
         case 'float':
             $v = (double) $v;
             break;
         case 'date':
         case 'datetime':
         case 'timestamp':
             if (preg_match('/int/i', $v)) {
                 $v = (int) $v;
             }
             break;
         default:
             break;
     }
     return parent::set($k, $v, $vType);
 }
예제 #10
0
 public function prepareRow(xPDOObject $object)
 {
     $object->set('relativeImage', $object->get('relativeImage'));
     return parent::prepareRow($object);
 }
예제 #11
0
 /**
  * Set the new name to the new object
  * @param string $name
  * @return string
  */
 public function setNewName($name)
 {
     return $this->newObject->set($this->nameField, $name);
 }
예제 #12
0
 public function prepareRow(xPDOObject $object)
 {
     /*
         Определяем тип объекта
     */
     if ($object instanceof ShopmodxResourceProductModel) {
         $object->set('object_type', 'model');
     } else {
         if ($object instanceof ShopmodxResourceProduct) {
             $object->set('object_type', 'product');
         } else {
             $object->set('object_type', 'document');
         }
     }
     return parent::prepareRow($object);
 }
예제 #13
0
 /**
  * Prepare the row for iteration
  * @param xPDOObject $object
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $objectArray = $object->toArray();
     $value = $objectArray['value'];
     $value = str_replace(',', '||', $value);
     $values = array_map('trim', @explode('||', $value));
     if (!empty($values)) {
         $valuesArray = array();
         foreach ($values as $value) {
             if (empty($value)) {
                 continue;
             }
             $valuesArray[] = $value;
             $tag = $this->modx->getObject('smarttagTags', array('tag:LIKE' => $value));
             if (!$tag) {
                 $tag = $this->modx->newObject('smarttagTags');
                 $tag->set('tag', $value);
                 if ($tag->save() === false) {
                     $this->modx->log(modX::LOG_LEVEL_ERROR, __LINE__ . ': Error on saving new tag data: ' . $value);
                     continue;
                 }
             }
             $params = array('tag_id' => $tag->getPrimaryKey(), 'tmplvar_id' => $objectArray['tmplvarid'], 'resource_id' => $objectArray['contentid']);
             $smarttagTagresource = $this->modx->getObject('smarttagTagresources', $params);
             if (!$smarttagTagresource) {
                 $smarttagTagresource = $this->modx->newObject('smarttagTagresources');
                 $smarttagTagresource->fromArray($params, NULL, TRUE, TRUE);
                 if ($smarttagTagresource->save() === false) {
                     $this->modx->log(modX::LOG_LEVEL_ERROR, __LINE__ . ': Error on saving new tag resource data: ' . print_r($params, 1));
                     continue;
                 }
                 $this->_count++;
             }
         }
         $valuesArray = array_unique($valuesArray);
         if (!empty($valuesArray)) {
             $newValue = @implode('||', $valuesArray);
             if ($objectArray['value'] !== $newValue) {
                 $object->set('value', $newValue);
                 if ($object->save()) {
                     $objectArray['value'] = $newValue;
                 }
             }
         }
     }
     return $objectArray;
 }
예제 #14
0
 public function prepareRow(xPDOObject $object)
 {
     $repeatmo = $object->get('repeatonmo');
     $repeatmo = explode(',', $repeatmo);
     $repeatmoArr = array();
     $repeatmoArr['type'] = !empty($repeatmo) ? $repeatmo[0] : null;
     $repeatmoArr['week'] = count($repeatmo) > 1 ? $repeatmo[1] : null;
     $object->set('startymd', date('Y-m-d', $object->get('start')));
     $object->set('starthis', date('g:i A', $object->get('start')));
     $object->set('endymd', date('Y-m-d', $object->get('end')));
     $object->set('endhis', date('g:i A', $object->get('end')));
     $object->set('startRAW', $object->get('start'));
     $object->set('start', date('Y-m-d g:i A', $object->get('start')));
     $object->set('end', date('Y-m-d g:i A', $object->get('end')));
     $object->set('repeatenddate', date('Y-m-d', $object->get('repeatenddate')));
     $object->set('repeatonc', ',' . $object->get('repeaton') . ',');
     $object->set('repeatonmo', $repeatmoArr);
     $object->set('ad', $object->get('ad') == 1 ? true : false);
     return $object->toArray();
 }