本文整理汇总了PHP中xPDOObject::set方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOObject::set方法的具体用法?PHP xPDOObject::set怎么用?PHP xPDOObject::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDOObject
的用法示例。
在下文中一共展示了xPDOObject::set方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRow
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: prepareRow
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: prepareRow
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);
}
示例4: set
/**
* 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: prepareRow
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: prepareRow
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: prepareRow
/**
* @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: prepareRow
/**
* @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: set
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: prepareRow
public function prepareRow(xPDOObject $object)
{
$object->set('relativeImage', $object->get('relativeImage'));
return parent::prepareRow($object);
}
示例11: setNewName
/**
* 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: prepareRow
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: prepareRow
/**
* 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: prepareRow
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();
}