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


PHP BaseModel::get方法代码示例

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


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

示例1: get

 public function get($type, array $params = array())
 {
     $url = self::METHOD_PATH . '/' . $type;
     $paramsString = $this->parseParams($params);
     $url .= $paramsString != '' ? '?' . $paramsString : '';
     return parent::get($url);
 }
开发者ID:nellurichaitanya,项目名称:api-client-php,代码行数:7,代码来源:Reports.php

示例2: get

 public function get(array $params = array())
 {
     $url = self::METHOD_PATH;
     $paramsString = $this->parseParams($params);
     $url .= $paramsString != "" ? "?" . $paramsString : "";
     return parent::get(self::METHOD_PATH);
 }
开发者ID:nellurichaitanya,项目名称:api-client-php,代码行数:7,代码来源:Visitors.php

示例3: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $solicitor = Solicitor::model()->findByPk($model->solicitor_id);
     $lists = BaseModel::getAll('Solicitor');
     $solicitors = array();
     foreach ($lists as $list) {
         $solicitors[$list->id] = $list->first_name . ' ' . $list->last_name . '(' . $list->solicitor_code . ')';
     }
     if (isset($_GET['visit'])) {
         $v_id = $_GET['visit'];
         $visit = BaseModel::get('Visits', array("condition" => "id = '{$v_id}'"));
         if ($visit !== null) {
             $model->visit_id = $visit->id;
             $model->solicitor_id = $visit->solicitor_id;
         }
     }
     $visits = CHtml::listData(Visits::model()->findAll(), 'id', 'visit_code');
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['SolicitorCredit'])) {
         $model->attributes = $_POST['SolicitorCredit'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'solicitor' => $solicitor, 'solicitors' => $solicitors, 'visits' => $visits));
 }
开发者ID:priyranjansingh,项目名称:donation,代码行数:33,代码来源:SolicitorCreditController.php

示例4: get

 public function get($login = null)
 {
     $url = self::METHOD_PATH;
     if ($login !== null) {
         $url .= '/' . $login;
     }
     return parent::get($url);
 }
开发者ID:nellurichaitanya,项目名称:api-client-php,代码行数:8,代码来源:Agents.php

示例5: get

 public function get($group = 0)
 {
     $this->ensureInteger($group);
     $url = self::METHOD_PATH;
     if ($group > 0) {
         $url .= '/' . $group;
     }
     return parent::get($url);
 }
开发者ID:nellurichaitanya,项目名称:api-client-php,代码行数:9,代码来源:Groups.php

示例6: get

 public function get($type, $params = array())
 {
     $url = 'reports/' . $type;
     $this->encodeParams($params);
     $params = $this->parseParams($params);
     $paramsString = http_build_query($params);
     $url .= $paramsString != "" ? "?" . $paramsString : "";
     return parent::get($url);
 }
开发者ID:invit,项目名称:livechat-api-client-php,代码行数:9,代码来源:Reports.php

示例7: get

 public function get($group = 0)
 {
     $group = (int) $group;
     $url = 'groups';
     if ($group !== 0) {
         $url .= '/' . $group;
     }
     return parent::get($url);
 }
开发者ID:invit,项目名称:livechat-api-client-php,代码行数:9,代码来源:Groups.php

示例8: get

 public function get($group = 0)
 {
     $group = (int) $group;
     $url = 'status';
     if ($group !== 0) {
         $url .= '/' . $group;
     }
     $status = parent::get($url);
     return $status->status;
 }
开发者ID:invit,项目名称:livechat-api-client-php,代码行数:10,代码来源:Status.php

示例9: get

 /**
  * {@inheritdoc}
  *
  * @return static
  */
 public static function get($id)
 {
     if (is_object($id)) {
         return parent::get($id);
     }
     $cache = Service::getModelCache();
     $id = (int) $id;
     if (!$cache) {
         // There is no cache, just get the model
         return parent::get($id);
     }
     if ($model = self::getFromCache($id)) {
         // The model exists in the cache, return that to the caller
         return $model;
     } else {
         return parent::get($id)->storeInCache();
     }
 }
开发者ID:allejo,项目名称:bzion,代码行数:23,代码来源:CachedModel.php

示例10: m

 function get_promotion_price($goods_id, $spec_id)
 {
     if (!$goods_id || !$spec_id) {
         return 0;
     }
     $spec_mod =& m('goodsspec');
     $spec = $spec_mod->get(array('conditions' => 'goods_id=' . $goods_id . ' AND spec_id=' . $spec_id, 'fields' => 'price'));
     $price = $old_price = $spec['price'];
     $promotion = parent::get(array('conditions' => "start_time<=" . gmtime() . " AND end_time>=" . gmtime() . " AND goods_id=" . $goods_id, 'fields' => 'spec_price'));
     if (!empty($promotion)) {
         $spec_price = unserialize($promotion['spec_price']);
         if ($spec_price[$spec_id]['is_pro'] == 1) {
             if ($spec_price[$spec_id]['pro_type'] == 'price') {
                 $pro_price = round($old_price - $spec_price[$spec_id]['price'], 2);
                 if ($pro_price > 0) {
                     $price = $pro_price;
                 }
             } else {
                 $price = round($old_price * $spec_price[$spec_id]['price'] / 1000, 4) * 100;
             }
         }
     }
     return $price;
 }
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:24,代码来源:promotion.model.php

示例11: get

 /**
  * Get value(s) for specified attribute. $ps_field specifies the value to fetch in <table_name>.<element_code> or <table_name>.<element_code>.<subelement_code>
  * Will return a string containing the retrieved value or values (since attributes can repeat). The values will
  * be formatted using the 'template' option with values separated by a delimiter as set in the 'delimiter'
  * option (default is a space). 
  *
  * If the 'returnAsArray' option is set the an array containing all values will be returned.
  * The array will be keyed on the current row primary key, and then attribute_id, with each attribute_id value containing an array keyed on element code and having
  * values set to attribute values (this is a bit more complicated than one might hope since not only can
  * values repeat, but they can be composed of many sub-values... the final array key'ed on element_code may have several values if the attribute is complex). 
  *
  * If the 'returnAllLocales' option is set *and* 'returnAsArray' is set then the returned array will include an extra dimension (or key if that's what you prefer to call it)
  * that separates values by numeric locale_id. Thus the returned array will have several layers of keys: current row primary key, then locale_id, then attribute_id and then
  * finally, element codes. This format is, incidentally, compatible with the caExtractValuesByUserLocale() helper function, which would strip all values not needed for
  * display in the current locale.
  *
  * @param $pa_options array - array of options for get; in addition to the standard get() options, will also pass through options to attribute value handlers
  *		Supported options include:
  *			locale = 
  *			returnAsArray = if true, return an array, otherwise return a string (default is false)
  *			returnAllLocales = 
  *			template = 
  *			delimiter = 
  *			convertCodesToDisplayText =
  *			returnAsLink = if true and $ps_field is a URL attribute and returnAllLocales is not set, then returned values will be links. Default is false.
  *			returnAsLinkText = *For URL attributes only* Text to use a content of HTML link. If omitted the url itself is used as the link content. 	 	 
  *			returnAsLinkAttributes = array of attributes to include in link <a> tag. Use this to set class, alt and any other link attributes.
  *
  * @return mixed - 
  *
  * 
  */
 public function get($ps_field, $pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vs_template = isset($pa_options['template']) ? $pa_options['template'] : null;
     $vs_delimiter = isset($pa_options['delimiter']) ? $pa_options['delimiter'] : ' ';
     $vb_return_as_array = isset($pa_options['returnAsArray']) ? (bool) $pa_options['returnAsArray'] : false;
     $vb_return_all_locales = isset($pa_options['returnAllLocales']) ? (bool) $pa_options['returnAllLocales'] : false;
     $vb_return_as_link = isset($pa_options['returnAsLink']) ? (bool) $pa_options['returnAsLink'] : false;
     $vs_return_as_link_text = isset($pa_options['returnAsLinkText']) ? (string) $pa_options['returnAsLinkText'] : '';
     $vs_return_as_link_attributes = isset($pa_options['returnAsLinkAttributes']) ? (string) $pa_options['returnAsLinkAttributes'] : array();
     if ($vb_return_all_locales && !$vb_return_as_array) {
         $vb_return_as_array = true;
     }
     if (!isset($pa_options['convertCodesToDisplayText'])) {
         $pa_options['convertCodesToDisplayText'] = false;
     }
     // does get refer to an attribute?
     $va_tmp = explode('.', $ps_field);
     $pa_options = array_merge($pa_options, array('indexByRowID' => true));
     // force arrays to be indexed by current row_id
     $t_instance = $this;
     if (sizeof($va_tmp) >= 2 && !$this->hasField($va_tmp[2])) {
         if ($va_tmp[1] == 'parent' && $this->isHierarchical() && ($vn_parent_id = $this->get($this->getProperty('HIERARCHY_PARENT_ID_FLD')))) {
             $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum());
             if (!$t_instance->load($vn_parent_id)) {
                 $t_instance = $this;
             } else {
                 unset($va_tmp[1]);
                 $va_tmp = array_values($va_tmp);
             }
         } else {
             if ($va_tmp[1] == 'children' && $this->isHierarchical()) {
                 unset($va_tmp[1]);
                 // remove 'children' from field path
                 $va_tmp = array_values($va_tmp);
                 $vs_childless_path = join('.', $va_tmp);
                 $va_data = array();
                 $va_children_ids = $this->getHierarchyChildren(null, array('idsOnly' => true));
                 $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum());
                 foreach ($va_children_ids as $vn_child_id) {
                     if ($t_instance->load($vn_child_id)) {
                         $vm_val = $t_instance->get($vs_childless_path, $pa_options);
                         $va_data = array_merge($va_data, is_array($vm_val) ? $vm_val : array($vm_val));
                     }
                 }
                 if ($vb_return_as_array) {
                     return $va_data;
                 } else {
                     return join($vs_delimiter, $va_data);
                 }
             }
         }
     }
     switch (sizeof($va_tmp)) {
         # -------------------------------------
         case 1:
             // simple name
             if (!$t_instance->hasField($va_tmp[0])) {
                 // is it intrinsic?
                 // nope... so try it as an attribute
                 if (!$vb_return_as_array) {
                     return $t_instance->getAttributesForDisplay($va_tmp[0], $vs_template, $pa_options);
                 } else {
                     $va_values = $t_instance->getAttributeDisplayValues($va_tmp[0], $t_instance->getPrimaryKey(), $pa_options);
                     if (!$vb_return_all_locales) {
                         $va_values = array_shift($va_values);
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:BaseModelWithAttributes.php

示例12: getTypeID

 /**
  * 
  */
 public function getTypeID($pn_id = NULL)
 {
     if ($pn_id) {
         $qr_res = $this->getDb()->query("SELECT type_id FROM " . $this->tableName() . " WHERE " . $this->primaryKey() . " = ?", array((int) $pn_id));
         if ($qr_res->nextRow()) {
             return $qr_res->get('type_id');
         }
         return null;
     }
     return BaseModel::hasField('type_id') ? BaseModel::get('type_id') : null;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:14,代码来源:BaseRelationshipModel.php

示例13: get

 public function get($login = null)
 {
     $url = 'agents' . (null !== $login ? '/' . $login : '');
     return parent::get($url);
 }
开发者ID:invit,项目名称:livechat-api-client-php,代码行数:5,代码来源:Agents.php

示例14: _checkAccess

 /**
  * Called just after record is deleted. Individual editor controllers can override this to implement their
  * own post-deletion cleanup logic.
  *
  * @param BaseModel $pt_subject Model instance of row that was deleted
  * @return bool True if post-deletion cleanup was successful, false if not
  */
 protected function _checkAccess($pt_subject, $pa_options = null)
 {
     //
     // Is record deleted?
     //
     if ($pt_subject->hasField('deleted') && $pt_subject->get('deleted')) {
         if (!caGetOption('dontRedirectOnDelete', $pa_options, false)) {
             $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2550?r=' . urlencode($this->request->getFullUrlPath()));
         }
         return false;
     }
     //
     // Is record of correct type?
     //
     $va_restrict_to_types = null;
     if ($pt_subject->getAppConfig()->get('perform_type_access_checking')) {
         $va_restrict_to_types = caGetTypeRestrictionsForUser($this->ops_table_name, array('access' => __CA_BUNDLE_ACCESS_READONLY__));
     }
     if (is_array($va_restrict_to_types) && ($pt_subject->get('type_id') && ($pt_subject->getPrimaryKey() && !in_array($pt_subject->get('type_id'), $va_restrict_to_types)))) {
         $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2560?r=' . urlencode($this->request->getFullUrlPath()));
         return false;
     }
     //
     // Is record from correct source?
     //
     $va_restrict_to_sources = null;
     if ($pt_subject->getAppConfig()->get('perform_source_access_checking') && $pt_subject->hasField('source_id')) {
         if (is_array($va_restrict_to_sources = caGetSourceRestrictionsForUser($this->ops_table_name, array('access' => __CA_BUNDLE_ACCESS_READONLY__)))) {
             if (!$pt_subject->get('source_id') || $pt_subject->get('source_id') && !in_array($pt_subject->get('source_id'), $va_restrict_to_sources) || strlen($vn_source_id = $this->request->getParameter('source_id', pInteger)) && !in_array($vn_source_id, $va_restrict_to_sources)) {
                 $pt_subject->set('source_id', $pt_subject->getDefaultSourceID(array('request' => $this->request)));
             }
             if (is_array($va_restrict_to_sources) && !in_array($pt_subject->get('source_id'), $va_restrict_to_sources)) {
                 $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2562?r=' . urlencode($this->request->getFullUrlPath()));
                 return;
             }
         }
     }
     //
     // Does user have access to row?
     //
     if ($pt_subject->getAppConfig()->get('perform_item_level_access_checking') && $vn_subject_id) {
         if ($pt_subject->checkACLAccessForUser($this->request->user) < __CA_BUNDLE_ACCESS_READONLY__) {
             $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2580?r=' . urlencode($this->request->getFullUrlPath()));
             return false;
         }
     }
     return true;
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:55,代码来源:BaseEditorController.php

示例15: get

 public function get()
 {
     return parent::get('visitors');
 }
开发者ID:invit,项目名称:livechat-api-client-php,代码行数:4,代码来源:Visitors.php


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