当前位置: 首页>>代码示例>>PHP>>正文


PHP xPDOObject::toArray方法代码示例

本文整理汇总了PHP中xPDOObject::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOObject::toArray方法的具体用法?PHP xPDOObject::toArray怎么用?PHP xPDOObject::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xPDOObject的用法示例。


在下文中一共展示了xPDOObject::toArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepareRow

 /**
  * Prepare the row for iteration
  * @param xPDOObject $object
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $objectArray = $object->toArray();
     $objectArray['catid'] = $objectArray['id'];
     $objectArray['text'] = $objectArray['name'];
     $hasChildren = $this->_hasChildren($objectArray['catid']);
     $objectArray['leaf'] = $hasChildren ? FALSE : TRUE;
     $usergroups = $object->getMany('vnewsCategoriesHasUsergroups');
     $usergroupsArray = array();
     if ($usergroups) {
         foreach ($usergroups as $usergroup) {
             $usergroupId = $usergroup->get('usergroup_id');
             $c = $this->modx->newQuery('modUserGroup');
             $c->where(array('id' => $usergroupId));
             $modUserGroup = $this->modx->getObject('modUserGroup', $c);
             if ($modUserGroup) {
                 $usergroupsArray[] = array('usergroup_id' => $usergroupId, 'usergroup' => $modUserGroup->get('name'));
             }
         }
     }
     $objectArray['usergroups'] = $usergroupsArray;
     unset($objectArray['id']);
     // avoid Ext component's ID
     return $objectArray;
 }
开发者ID:ksneo,项目名称:virtuNewsletter,代码行数:30,代码来源:gettreelist.class.php

示例2: prepareRow

 public function prepareRow(xPDOObject $object)
 {
     $objectArray = $object->toArray();
     $objectArray['sender_name'] = $object->get('sender_username');
     $objectArray['read'] = $object->get('read') ? true : false;
     return $objectArray;
 }
开发者ID:adamwintle,项目名称:flexibility5,代码行数:7,代码来源:getlist.class.php

示例3: prepareRow

 /**
  * @param xPDOObject|quipCommentNotify $object
  * @return boolean
  */
 public function prepareRow(xPDOObject $object)
 {
     $notifyArray = $object->toArray();
     $notifyArray['cls'] = '';
     $notifyArray['createdon'] = !empty($notifyArray['createdon']) ? strftime('%b %d, %Y %H:%M %p', strtotime($notifyArray['createdon'])) : '';
     return $notifyArray;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:11,代码来源:getlist.class.php

示例4: prepareRow

 /**
  * @param xPDOObject $object
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $array = $object->toArray();
     $array['actions'] = array();
     if (!($user = $this->modx->getObject('modUser', $array['user_id']))) {
         return $this->failure($this->modx->lexicon('identifyx_user_err_nf') . ' №' . $id);
     }
     $blocked = $user->Profile->get('blocked');
     if ($blocked) {
         $array['actions'][] = array('cls' => '', 'icon' => 'icon icon-power-off action-green', 'title' => $this->modx->lexicon('identifyx_user_enable'), 'multiple' => $this->modx->lexicon('identifyx_users_enable'), 'action' => 'unblockUser', 'button' => true, 'menu' => true);
     } else {
         $array['actions'][] = array('cls' => '', 'icon' => 'icon icon-power-off action-gray', 'title' => $this->modx->lexicon('identifyx_user_disable'), 'multiple' => $this->modx->lexicon('identifyx_users_disable'), 'action' => 'blockUser', 'button' => true, 'menu' => true);
     }
     // // Edit
     // $array['actions'][] = array(
     // 	'cls' => '',
     // 	'icon' => 'icon icon-edit',
     // 	'title' => $this->modx->lexicon('identifyx_item_update'),
     // 	'multiple' => $this->modx->lexicon('identifyx_items_update'),
     // 	'action' => 'updateData',
     // 	'button' => true,
     // 	'menu' => true,
     // );
     // // Remove
     // $array['actions'][] = array(
     // 	'cls' => '',
     // 	'icon' => 'icon icon-trash-o action-red',
     // 	'title' => $this->modx->lexicon('identifyx_item_remove'),
     // 	'multiple' => $this->modx->lexicon('identifyx_items_remove'),
     // 	'action' => 'removeData',
     // 	'button' => true,
     // 	'menu' => true,
     // );
     return $array;
 }
开发者ID:Piterden,项目名称:IdentifyX,代码行数:39,代码来源:getlist.class.php

示例5: prepareRow

 public function prepareRow(xPDOObject $object)
 {
     $ff = $object->toArray();
     $ff['encrypted'] = $this->modx->getCount($this->classKey, array('form' => $ff['form'], 'encrypted' => 1));
     $ff['total'] = $this->modx->getCount($this->classKey, array('form' => $ff['form']));
     return $ff;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:7,代码来源:getlistsingle.class.php

示例6: delete

 /**
  * Handle DELETE requests
  * @return array
  */
 public function delete()
 {
     $id = $this->getProperty($this->primaryKeyField, false);
     if (empty($id)) {
         return $this->failure($this->modx->lexicon('rest.err_field_ns', array('field' => $this->primaryKeyField)));
     }
     $c = $this->getPrimaryKeyCriteria($id);
     $this->object = $this->modx->getObject($this->classKey, $c);
     if (empty($this->object)) {
         return $this->failure($this->modx->lexicon('rest.err_obj_nf', array('class_key' => $this->classKey)));
     }
     if (!empty($this->deleteRequiredFields)) {
         if (!$this->checkRequiredFields($this->deleteRequiredFields)) {
             return $this->failure();
         }
     }
     $this->object->fromArray($this->getProperties());
     $beforeDelete = $this->beforeDelete();
     if ($beforeDelete !== true) {
         return $this->failure($beforeDelete === false ? $this->errorMessage : $beforeDelete);
     }
     if (!$this->object->{$this->deleteMethod}()) {
         $this->setObjectErrors();
         return $this->failure($this->modx->lexicon('rest.err_class_remove', array('class_key' => $this->classKey)));
     }
     $objectArray = $this->object->toArray();
     $this->afterDelete($objectArray);
     return $this->success('', $objectArray);
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:33,代码来源:modrestcontroller.class.php

示例7: prepareRow

 public function prepareRow(xPDOObject $object)
 {
     $objectArray = $object->toArray();
     $objectArray['category_name'] = $object->get('category_name');
     unset($objectArray['content']);
     return $objectArray;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:7,代码来源:getlist.class.php

示例8: prepareRow

 /**
  * Prepare the row for iteration
  * @param xPDOObject $object
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $objectArray = $object->toArray();
     unset($objectArray['password'], $objectArray['cachepwd'], $objectArray['salt'], $objectArray['class_key'], $objectArray['active'], $objectArray['remote_key'], $objectArray['remote_data'], $objectArray['hash_class'], $objectArray['primary_group'], $objectArray['session_stale'], $objectArray['sudo'], $objectArray['blocked']);
     $objectArray['uid'] = $objectArray['id'];
     $objectArray['text'] = $objectArray['username'] . ' (' . $objectArray['id'] . ')';
     $basePath = $this->modx->getOption('uploadtousers.base_path', null, $this->modx->getOption('assets_path') . 'userfiles/');
     if (!is_dir($basePath)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, $basePath . ' for Upload to Users package does not exist.');
         return $objectArray;
     }
     $folderName = $this->modx->getOption('uploadtousers.foldername');
     if (!empty($folderName)) {
         switch ($folderName) {
             case 'id':
                 $dirPath = $basePath . $objectArray['uid'] . '/';
                 break;
             case 'username':
                 $dirPath = $basePath . $objectArray['username'] . '/';
                 break;
             default:
                 break;
         }
         $objectArray['leaf'] = $this->_leaf($dirPath);
     }
     if (!is_dir($dirPath)) {
         @mkdir($dirPath);
     }
     $objectArray['dirPath'] = $dirPath;
     $objectArray['type'] = 'user';
     unset($objectArray['id']);
     // avoid Ext component's ID
     return $objectArray;
 }
开发者ID:vgrish,项目名称:UploadToUsers,代码行数:39,代码来源:getlist.class.php

示例9: prepareRow

 public function prepareRow(xPDOObject $object)
 {
     $core = array('Resource', 'Object', 'Administrator', 'Load Only', 'Load, List and View');
     $policyArray = $object->toArray();
     $permissions = array();
     $cls = 'pedit';
     if (!in_array($object->get('name'), $core)) {
         $cls .= ' premove';
     }
     $policyArray['cls'] = $cls;
     if (!empty($policyArray['total_permissions'])) {
         $data = $object->get('data');
         $ct = 0;
         if (!empty($data)) {
             foreach ($data as $k => $v) {
                 if (!empty($v)) {
                     $permissions[] = $k;
                     $ct++;
                 }
             }
         }
         $policyArray['active_permissions'] = $ct;
         $policyArray['active_of'] = $this->modx->lexicon('active_of', array('active' => $policyArray['active_permissions'], 'total' => $policyArray['total_permissions']));
         $policyArray['permissions'] = $permissions;
     }
     unset($policyArray['data']);
     return $policyArray;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:28,代码来源:getlist.class.php

示例10: prepareRow

 /**
  * @param xPDOObject $object
  *
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $array = $object->toArray();
     $array['key'] = $array['classKey'] . '-' . $array['item'];
     switch ($array['classKey']) {
         case 'modTemplate':
             $array['name'] = '<a href="index.php?a=element/template/update&id=' . $array['item'] . '">' . $array['templatename'] . '</a>';
             break;
         case 'modChunk':
             $array['name'] = '<a href="index.php?a=element/chunk/update&id=' . $array['item'] . '">' . $array['chunkname'] . '</a>';
             break;
         case 'modSnippet':
             $array['name'] = '<a href="index.php?a=element/snippet/update&id=' . $array['item'] . '">' . $array['snippetname'] . '</a>';
             break;
         case 'modPlugin':
             $array['name'] = '<a href="index.php?a=element/plugin/update&id=' . $array['item'] . '">' . $array['pluginname'] . '</a>';
             break;
         case 'modTemplateVar':
             $array['name'] = '<a href="index.php?a=element/tv/update&id=' . $array['item'] . '">' . $array['tvname'] . '</a>';
             break;
     }
     if (!isset($array['name'])) {
         $array['name'] = '(' . $this->modx->lexicon('deleted') . ')';
     }
     unset($array['templatename'], $array['chunkname'], $array['snippetname'], $array['pluginname'], $array['id']);
     $array['actions'][] = array('cls' => '', 'icon' => 'icon icon-pencil-square-o ', 'title' => $this->modx->lexicon('admintools_open'), 'action' => 'openElement', 'button' => true, 'menu' => true);
     return $array;
 }
开发者ID:sergant210,项目名称:AdminTools,代码行数:33,代码来源:getlist.class.php

示例11: prepareRow

 public function prepareRow(xPDOObject $object)
 {
     $itemArray = $object->toArray();
     $itemArray['album'] = $this->getProperty('album');
     $itemArray['filename'] = basename($object->get('filename'));
     $imagePath = $object->get('image_path');
     $size = @getimagesize($imagePath);
     if (is_array($size)) {
         $itemArray['image_width'] = $size[0];
         $itemArray['image_height'] = $size[1];
         $itemArray['image_type'] = $size[2];
     }
     $c = array();
     $c['h'] = $this->modx->getOption('gallery.backend_thumb_height', null, 60);
     $c['w'] = $this->modx->getOption('gallery.backend_thumb_width', null, 80);
     $c['zc'] = $this->modx->getOption('gallery.backend_thumb_zoomcrop', null, 1);
     $c['far'] = $this->modx->getOption('gallery.backend_thumb_far', null, 'C');
     $itemArray['thumbnail'] = $object->get('thumbnail', $c);
     $itemArray['image'] = $object->get('image');
     $itemArray['relativeImage'] = $object->get('relativeImage');
     $itemArray['absoluteImage'] = $object->get('absoluteImage');
     $itemArray['filesize'] = $object->get('filesize');
     $itemArray['menu'] = array();
     $itemArray['menu'][] = array('text' => $this->modx->lexicon('gallery.item_update'), 'handler' => 'this.updateItem');
     $itemArray['menu'][] = '-';
     $itemArray['menu'][] = array('text' => $this->modx->lexicon('gallery.item_delete'), 'handler' => 'this.deleteItem');
     return $itemArray;
 }
开发者ID:Piterden,项目名称:modx_testfloor,代码行数:28,代码来源:getlist.class.php

示例12: prepareRow

 /**
  * Prepare the row for iteration
  * @param xPDOObject $object
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $objectArray = $object->toArray();
     $objectArray['usergroups'] = '';
     if (!empty($objectArray['user_id'])) {
         $userObj = $this->modx->getObject('modUser', $objectArray['user_id']);
         if ($userObj) {
             $usergroups = $userObj->getUserGroupNames();
             if ($usergroups) {
                 $objectArray['usergroups'] = @implode(',', $usergroups);
             }
         }
     }
     $subscribersHasCategories = $object->getMany('vnewsSubscribersHasCategories');
     $objectArray['categories'] = '';
     if ($subscribersHasCategories) {
         $categories = array();
         foreach ($subscribersHasCategories as $subsHasCats) {
             $category = $subsHasCats->getOne('vnewsCategories');
             $categories[] = $category->get('name');
         }
         $objectArray['categories'] = @implode(',', $categories);
     }
     return $objectArray;
 }
开发者ID:ksneo,项目名称:virtuNewsletter,代码行数:30,代码来源:getlist.class.php

示例13: prepareRow

 /** {@inheritDoc} */
 public function prepareRow(xPDOObject $object)
 {
     $icon = 'fa';
     $array = $object->toArray();
     $array['actions'] = array();
     // Menu
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-cog actions-menu", 'menu' => false, 'button' => true, 'action' => 'showMenu', 'type' => 'menu');
     // Edit
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-edit green", 'title' => $this->modx->lexicon('mlmsystem_action_edit'), 'action' => 'update', 'button' => true, 'menu' => true);
     // sep
     $array['actions'][] = array('cls' => '', 'icon' => '', 'title' => '', 'action' => 'sep', 'button' => false, 'menu' => true);
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-street-view", 'title' => $this->modx->lexicon('mlmsystem_action_change_parent'), 'action' => 'changeParent', 'button' => false, 'menu' => true);
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-money ", 'title' => $this->modx->lexicon('mlmsystem_action_change_balance'), 'action' => 'changeBalance', 'button' => true, 'menu' => true);
     // sep
     $array['actions'][] = array('cls' => '', 'icon' => '', 'title' => '', 'action' => 'sep', 'button' => false, 'menu' => true);
     //Blocked status
     if ($array['status'] != $this->statusBlocked) {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-unlock-alt red", 'title' => $this->modx->lexicon('mlmsystem_action_active_blocked'), 'action' => 'activeBlocked', 'button' => false, 'menu' => true);
     } else {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-unlock green", 'title' => $this->modx->lexicon('mlmsystem_action_inactive_blocked'), 'action' => 'inactiveBlocked', 'button' => false, 'menu' => true);
     }
     if (!$array['leader']) {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-shield green", 'title' => $this->modx->lexicon('mlmsystem_action_active_leader'), 'action' => 'activeLeader', 'button' => false, 'menu' => true);
     } else {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-shield red", 'title' => $this->modx->lexicon('mlmsystem_action_inactive_leader'), 'action' => 'inactiveLeader', 'button' => false, 'menu' => true);
     }
     // Remove
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-trash-o red", 'title' => $this->modx->lexicon('mlmsystem_action_remove'), 'action' => 'remove', 'button' => false, 'menu' => true);
     return $array;
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:31,代码来源:getlist.class.php

示例14: prepareRow

 /**
  * @param xPDOObject $object
  *
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $icon = 'fa';
     $array = $object->toArray();
     $array['actions'] = array();
     // Edit
     /*$array['actions'][] = array(
     			'cls' => '',
     			'icon' => "$icon $icon-eye green",
     			'title' => $this->modx->lexicon('gl_action_view'),
     			'action' => 'update',
     			'button' => true,
     			'menu' => true,
     		);*/
     if (!$array['active']) {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-toggle-off red", 'title' => $this->modx->lexicon('gl_action_active'), 'action' => 'active', 'button' => true, 'menu' => true);
     } else {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-toggle-on green", 'title' => $this->modx->lexicon('gl_action_inactive'), 'action' => 'inactive', 'button' => true, 'menu' => true);
     }
     // sep
     $array['actions'][] = array('cls' => '', 'icon' => '', 'title' => '', 'action' => 'sep', 'button' => false, 'menu' => true);
     // Remove
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-trash-o red", 'title' => $this->modx->lexicon('gl_action_remove'), 'action' => 'remove', 'button' => true, 'menu' => true);
     return $array;
 }
开发者ID:ViieeS,项目名称:gl,代码行数:30,代码来源:getlist.class.php

示例15: prepareRow

 /**
  * @param xPDOObject $object
  *
  * @return array
  */
 public function prepareRow(xPDOObject $object)
 {
     $icon = 'icon';
     $array = $object->toArray();
     $array['actions'] = array();
     // Edit
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-edit green", 'title' => $this->modx->lexicon('gl_action_update'), 'action' => 'update', 'button' => true, 'menu' => true);
     if ($array['default']) {
         return $array;
     }
     switch (true) {
         case $array['active']:
             break;
         case $array['active1']:
             $array['active'] = 1;
             break;
         case $array['active2']:
             $array['active'] = 1;
             break;
         default:
             $array['active'] = 0;
     }
     if (!$array['active']) {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-toggle-off red", 'title' => $this->modx->lexicon('gl_action_active'), 'action' => 'active', 'button' => true, 'menu' => true);
     } else {
         $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-toggle-on green", 'title' => $this->modx->lexicon('gl_action_inactive'), 'action' => 'inactive', 'button' => true, 'menu' => true);
     }
     // sep
     $array['actions'][] = array('cls' => '', 'icon' => '', 'title' => '', 'action' => 'sep', 'button' => false, 'menu' => true);
     // Remove
     $array['actions'][] = array('cls' => '', 'icon' => "{$icon} {$icon}-trash-o red", 'title' => $this->modx->lexicon('gl_action_remove'), 'action' => 'remove', 'button' => true, 'menu' => true);
     return $array;
 }
开发者ID:vgrish,项目名称:gl,代码行数:38,代码来源:getlist.class.php


注:本文中的xPDOObject::toArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。