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


PHP object::count方法代码示例

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


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

示例1: renderIndex

 protected function renderIndex()
 {
     $data['schema'] = $this->model->schema;
     $data['primary'] = $this->model->primary;
     //$this->
     $where = [];
     $grid['filter'] = isset($this->grid['filter']) ? $this->grid['filter'] : [];
     foreach ($grid['filter'] as $key => $value) {
         if ($this->input->get($key)) {
             $where[$key] = $this->input->get($key);
         }
     }
     $grid['page'] = isset($this->grid['page']) ? $this->grid['page'] : (intval($this->input->get('page')) ? intval($this->input->get('page')) : 1);
     $grid['pageSize'] = isset($this->grid['pageSize']) ? $this->grid['pageSize'] : 12;
     $grid['total'] = isset($this->grid['total']) ? $this->grid['total'] : $this->model->count($where);
     $grid['fields'] = isset($this->grid['fields']) ? $this->grid['fields'] : array_keys($this->model->schema);
     $grid['fieldshow'] = isset($this->grid['fieldshow']) ? $this->grid['fieldshow'] : null;
     $grid['datasource'] = isset($this->grid['page']) ? $this->grid['datasource'] : $this->model->query($where, $grid['fields'], [$this->model->primary => 'desc'], [$grid['pageSize'] * ($grid['page'] - 1), $grid['pageSize']]);
     $grid['pager'] = isset($this->grid['pager']) ? $this->grid['pager'] : $this->helper->backstage->paging($grid['pageSize'], $grid['total'], $grid['page'], $this->helper->backstage->uri(['page' => '']));
     $grid['tools'] = isset($this->grid['tools']) ? $this->grid['tools'] : ['add' => $this->helper->form->button(['properties' => ['id' => 'add', 'onclick' => 'edit()'], 'label' => '增加'])];
     $grid['operations'] = isset($this->grid['operations']) ? $this->grid['operations'] : [['name' => '操作', 'action' => function ($record) {
         return '<a href="javascript:del(' . $record->id . ')">删除</a> | <a href="javascript:update(' . $record->id . ')">修改</a>';
     }]];
     $data['grid'] = $grid;
     $this->output->view('common/index', $data);
 }
开发者ID:beyondye,项目名称:ENPHP,代码行数:26,代码来源:controller.php

示例2: removeParent

 /**
  * Unset a parent.
  *
  * @param  pbject $parent The parent instance to unset.
  * @return self
  */
 public function removeParent($parent)
 {
     $this->_parents->remove($parent);
     if ($this->_parents->count() === 0) {
         $this->collector()->remove($this->uuid());
     }
     return $this;
 }
开发者ID:crysalead,项目名称:chaos,代码行数:14,代码来源:Document.php

示例3: hasTickets

 /**
  * hasTickets - check if there are Tickets related to a project
  *
  * @access public
  * @param $id
  * @return boolean
  */
 public function hasTickets($id)
 {
     $query = "SELECT id FROM zp_tickets WHERE projectId = '" . $id . "' LIMIT 1";
     $this->db->dbQuery($query);
     if ($this->db->count() == 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:17,代码来源:class.projects.php

示例4: hasTickets

 /**
  * hasTickets - check if a project has Tickets
  *
  * @access public
  * @param $id
  * @return boolean
  */
 public function hasTickets($id)
 {
     $query = "SELECT zp_projects.id FROM zp_projects JOIN zp_tickets ON zp_projects.id = zp_tickets.projectId WHERE zp_projects.clientId = '" . $id . "'";
     $this->db->dbQuery($query);
     if ($this->db->count() == 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:17,代码来源:class.clients.php

示例5: parseAlbums

 /**
  * parseAlbums function.
  *
  * @access private
  * @return void
  */
 private function parseAlbums()
 {
     if (!is_object($this->objAlbums) || $this->objAlbums->count() < 1) {
         $this->setEmptyTemplate($GLOBALS['TL_LANG']['MSC']['albumsNotFound']);
         return;
     }
     // Import
     $this->import('Session');
     // Define vars
     global $objPage;
     $arrItems = array();
     $objAlbums = $this->objAlbums;
     $total = $objAlbums->count();
     $i = 0;
     // Set page session vars to generate backlink in detail page
     $this->Session->set('pa2PageNumber_' . $this->Template->id, \Input::get('page') ? \Input::get('page') : 1);
     $this->Session->set('pa2PageId_' . $this->Template->id, $objPage->id);
     if ($objAlbums !== null) {
         while ($objAlbums->next()) {
             // Generate subtemplate object
             $objSubtemplate = new \FrontendTemplate($this->Template->strSubtemplate);
             $objSubtemplate->setData($this->Template->getData());
             // Set template variables
             $objSubtemplate->title = strip_tags($objAlbums->title);
             $objSubtemplate->alt = strip_tags($objAlbums->title);
             $objSubtemplate->showTitle = $objSubtemplate->title != '' ? $objSubtemplate->showTitle : false;
             $objSubtemplate->event = $objAlbums->event;
             $objSubtemplate->place = $objAlbums->place;
             $objSubtemplate->photographer = $objAlbums->photographer;
             $objSubtemplate->description = $objAlbums->description;
             $objSubtemplate->numberOfAllImages = count($objAlbums->arrSortedImageUuids);
             // Call template methods
             $objSubtemplate = $this->addDateToTemplate($objSubtemplate, $objAlbums->startdate, $objAlbums->enddate);
             $objSubtemplate = $this->addSpecificClassesToTemplate($objSubtemplate, $i);
             $objSubtemplate = $this->addLinkToTemplate($objSubtemplate, $objAlbums->current());
             $objSubtemplate = $this->addMetaFieldsToTemplate($objSubtemplate);
             // Add preview image to template
             $objPa2PreviewImage = new \Pa2PreviewImage($objAlbums->current(), $objSubtemplate->pa2PreviewImage);
             $objPa2Image = new \Pa2Image($objPa2PreviewImage->getPreviewImageUuid());
             $objPa2Image->addPa2ImageToTemplate($objSubtemplate);
             // Add album class to the class string
             $objSubtemplate->class .= $objSubtemplate->class == '' ? $objAlbums->cssClass : ' ' . $objAlbums->cssClass;
             // If album lightbox is activated the images will be added to the album template
             $objSubtemplate = $this->albumLightbox($objSubtemplate, $objAlbums->current());
             // Parse subtemplate
             $arrItems[] = $objSubtemplate->parse();
             $i++;
         }
     }
     $this->Template->items = $arrItems;
 }
开发者ID:craffft,项目名称:contao-photoalbums2,代码行数:57,代码来源:Pa2AlbumViewParser.php

示例6: get_venues

 public function get_venues($per_page = 10, $count = FALSE)
 {
     $_orderby = !empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
     switch ($_orderby) {
         case 'id':
             $orderby = 'VNU_ID';
             break;
         case 'capacity':
             $orderby = 'VNU_capacity';
             break;
         case 'city':
             $orderby = 'VNU_city';
             break;
         default:
             $orderby = 'VNU_name';
     }
     $sort = isset($this->_req_data['order']) && !empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
     $current_page = isset($this->_req_data['paged']) && !empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
     $per_page = isset($per_page) && !empty($per_page) ? $per_page : 10;
     $per_page = isset($this->_req_data['perpage']) && !empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
     $offset = ($current_page - 1) * $per_page;
     $limit = array($offset, $per_page);
     $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
     $where = array();
     //only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
     if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
         $where['status'] = $this->_req_data['status'];
     }
     if (isset($this->_req_data['venue_status'])) {
         $where['status'] = $this->_req_data['venue_status'];
     }
     if ($category) {
         $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
         $where['Term_Taxonomy.term_id'] = $category;
     }
     if (!EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
         $where['VNU_wp_user'] = get_current_user_id();
     } else {
         if (!EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
             $where['OR'] = array('status*restrict_private' => array('!=', 'private'), 'AND' => array('status*inclusive' => array('=', 'private'), 'VNU_wp_user' => get_current_user_id()));
         }
     }
     if (isset($this->_req_data['s'])) {
         $sstr = '%' . $this->_req_data['s'] . '%';
         $where['OR'] = array('VNU_name' => array('LIKE', $sstr), 'VNU_desc' => array('LIKE', $sstr), 'VNU_short_desc' => array('LIKE', $sstr), 'VNU_address' => array('LIKE', $sstr), 'VNU_address2' => array('LIKE', $sstr), 'VNU_city' => array('LIKE', $sstr), 'VNU_zip' => array('LIKE', $sstr), 'VNU_phone' => array('LIKE', $sstr), 'VNU_url' => array('LIKE', $sstr), 'VNU_virtual_phone' => array('LIKE', $sstr), 'VNU_virtual_url' => array('LIKE', $sstr), 'VNU_google_map_link' => array('LIKE', $sstr), 'Event.EVT_name' => array('LIKE', $sstr), 'Event.EVT_desc' => array('LIKE', $sstr), 'Event.EVT_phone' => array('LIKE', $sstr), 'Event.EVT_external_URL' => array('LIKE', $sstr));
     }
     $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
     return $venues;
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:49,代码来源:Venues_Admin_Page.core.php

示例7: encode

 /**
  * Encode the result set into a collection of models
  * @param  object   $resultSet         The result set to hydrate with
  * @param  object   $modelToHydrate    The model to hydrate
  * @return boolean|\Application\Model\BlogPost
  */
 public function encode($resultSet, $modelToHydrate)
 {
     $collection = array();
     if ($resultSet->count() == 0) {
         return false;
     }
     foreach ($resultSet as $row) {
         foreach ($this->fields as $key => $value) {
             if (isset($row[$value])) {
                 $row[$key] = $row[$value];
             }
         }
         array_push($collection, new $modelToHydrate($row));
     }
     return $collection;
 }
开发者ID:DCONLINE1984,项目名称:surveyengine,代码行数:22,代码来源:CommonEncoder.php

示例8: version

 /**
  * Load Page Version
  *
  * @param   mixed  $vid Version Id
  * @return  object \Components\Groups\Models\Page\Version
  */
 public function version($vid = null)
 {
     // var to hold version
     $version = new Page\Version();
     // make sure we have versions to return
     if ($this->_versions->count() > 0) {
         // return version object
         if ($vid == null || $vid == 0 || $vid == 'current') {
             $version = $this->_versions->first();
         } else {
             if (is_numeric($vid)) {
                 $version = $this->_versions->fetch('version', $vid);
             }
         }
     }
     //return version
     return $version;
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:24,代码来源:page.php

示例9: get_venues

 public function get_venues($per_page = 10, $count = FALSE)
 {
     $_orderby = !empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
     switch ($_orderby) {
         case 'id':
             $orderby = 'VNU_ID';
             break;
         case 'capacity':
             $orderby = 'VNU_capacity';
             break;
         case 'city':
             $orderby = 'VNU_city';
             break;
         default:
             $orderby = 'VNU_name';
     }
     $sort = isset($this->_req_data['order']) && !empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
     $current_page = isset($this->_req_data['paged']) && !empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
     $per_page = isset($per_page) && !empty($per_page) ? $per_page : 10;
     $per_page = isset($this->_req_data['perpage']) && !empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
     $offset = ($current_page - 1) * $per_page;
     $limit = array($offset, $per_page);
     $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
     $where = array('status' => isset($this->_req_data['status']) && $this->_req_data['status'] != 'all' ? $this->_req_data['status'] : array('IN', array('publish', 'draft')));
     if ($category) {
         $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
         $where['Term_Taxonomy.term_id'] = $category;
     }
     //cap checks
     if (EE_Registry::instance()->CAP->current_user_can('ee_edit_private_venues', 'get_venue')) {
         if (!empty($where['status'][0]) && $where['status'][0] == 'IN') {
             $where['status'][1][] = 'private';
         }
     }
     if (!EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
         $where['VNU_wp_user'] = get_current_user_id();
     }
     if (isset($this->_req_data['s'])) {
         $sstr = '%' . $this->_req_data['s'] . '%';
         $where['OR'] = array('VNU_name' => array('LIKE', $sstr), 'VNU_desc' => array('LIKE', $sstr), 'VNU_short_desc' => array('LIKE', $sstr), 'VNU_address' => array('LIKE', $sstr), 'VNU_address2' => array('LIKE', $sstr), 'VNU_city' => array('LIKE', $sstr), 'VNU_zip' => array('LIKE', $sstr), 'VNU_phone' => array('LIKE', $sstr), 'VNU_url' => array('LIKE', $sstr), 'VNU_virtual_phone' => array('LIKE', $sstr), 'VNU_virtual_url' => array('LIKE', $sstr), 'VNU_google_map_link' => array('LIKE', $sstr), 'Event.EVT_name' => array('LIKE', $sstr), 'Event.EVT_desc' => array('LIKE', $sstr), 'Event.EVT_phone' => array('LIKE', $sstr), 'Event.EVT_external_URL' => array('LIKE', $sstr));
     }
     $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
     return $venues;
 }
开发者ID:rheator,项目名称:event-espresso-core,代码行数:44,代码来源:Venues_Admin_Page.core.php

示例10: render_inputs

 /**
  * Generate HTML string of form input controls
  *
  * @param string $details
  * @return void
  * @author Drew McLellan
  */
 public function render_inputs($details = array())
 {
     $s = '';
     $id = $this->Tag->id();
     $attrs = array();
     if ($this->Tag->placeholder()) {
         $attrs[] = 'placeholder="' . PerchUtil::html($this->Tag->placeholder(), true) . '"';
     }
     if ($this->Tag->count()) {
         if ($this->Tag->count() == 'chars') {
             $attrs[] = 'data-count="chars"';
         }
         if ($this->Tag->count() == 'words') {
             $attrs[] = 'data-count="words"';
         }
         $attrs[] = 'data-count-container="' . $this->Tag->input_id() . '__count"';
     }
     $attrs = implode(' ', $attrs);
     $s = $this->Form->text($this->Tag->input_id(), $this->Form->get($details, $id, $this->Tag->default(), $this->Tag->post_prefix()), $this->Tag->size(), $this->Tag->maxlength(), 'text', $attrs . $this->Tag->get_data_attribute_string());
     if ($this->Tag->count()) {
         $s .= '<div class="counter text-counter" id="' . $this->Tag->input_id() . '__count"></div>';
     }
     return $s;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:31,代码来源:PerchFieldType.class.php

示例11: count

 /**
  * Countable implementation
  *
  * @return int number of documents
  */
 public function count()
 {
     return $this->result->count();
 }
开发者ID:schpill,项目名称:standalone,代码行数:9,代码来源:Cursor.php

示例12: objectToString

 /**
  * Render an object to a string
  * 
  * @param Wire|object $value
  * @return string
  * 
  */
 protected function objectToString($value)
 {
     if ($value instanceof WireArray && !$value->count()) {
         return '';
     }
     if ($value instanceof Page) {
         return $value->get('title|name');
     }
     if ($value instanceof Pagefiles || $value instanceof Pagefile) {
         $out = $this->renderInputfieldValue($value);
     } else {
         $className = get_class($value);
         $out = (string) $value;
         if ($out === $className) {
             // just the class name probably isn't useful here, see if we can do do something else with it
             $this->renderIsUseless = true;
         }
     }
     return $out;
 }
开发者ID:Smubs,项目名称:ProcessWire,代码行数:27,代码来源:MarkupFieldtype.php

示例13: _getProductPos

 /**
  * Searches for current article in article list and sets previous/next product ids
  *
  * @param oxarticle $oArticle       current Article
  * @param object    $oIdList        articles list containing only fake article objects !!!
  * @param oxubase   $oLocatorTarget oxubase object
  *
  * @return integer
  */
 protected function _getProductPos($oArticle, $oIdList, $oLocatorTarget)
 {
     $iCnt = 1;
     $iPos = 0;
     // variant handling
     $sOxid = $oArticle->oxarticles__oxparentid->value ? $oArticle->oxarticles__oxparentid->value : $oArticle->getId();
     if ($oIdList->count() && isset($oIdList[$sOxid])) {
         $aIds = $oIdList->arrayKeys();
         $iPos = oxRegistry::getUtils()->arrayStringSearch($sOxid, $aIds);
         if (array_key_exists($iPos - 1, $aIds)) {
             $oBackProduct = oxNew('oxArticle');
             $oBackProduct->modifyCacheKey('_locator');
             $oBackProduct->setNoVariantLoading(true);
             if ($oBackProduct->load($aIds[$iPos - 1])) {
                 $oBackProduct->setLinkType($oLocatorTarget->getLinkType());
                 $this->_oBackProduct = $oBackProduct;
             }
         }
         if (array_key_exists($iPos + 1, $aIds)) {
             $oNextProduct = oxNew('oxArticle');
             $oNextProduct->modifyCacheKey('_locator');
             $oNextProduct->setNoVariantLoading(true);
             if ($oNextProduct->load($aIds[$iPos + 1])) {
                 $oNextProduct->setLinkType($oLocatorTarget->getLinkType());
                 $this->_oNextProduct = $oNextProduct;
             }
         }
         return $iPos + 1;
     }
     return 0;
 }
开发者ID:Alpha-Sys,项目名称:oxideshop_ce,代码行数:40,代码来源:Locator.php

示例14: _getXMLParams

/**
 * parse SimpleXMLElement instance property parameters and return iCalcreator property parameter array
 *
 * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
 * @since  2.11.2 - 2012-01-15
 * @param  object $parameters SimpleXMLElement
 * @return array  iCalcreator property parameter array
 */
function _getXMLParams(&$parameters)
{
    if (1 > $parameters->count()) {
        return array();
    }
    $params = array();
    foreach ($parameters->children() as $parameter) {
        // single parameter key
        $key = strtoupper($parameter->getName());
        $value = array();
        foreach ($parameter->children() as $paramValue) {
            // skip parameter value type
            $value[] = reset($paramValue);
        }
        if (2 > count($value)) {
            $params[$key] = html_entity_decode(reset($value));
        } else {
            $params[$key] = $value;
        }
    }
    return $params;
}
开发者ID:cjvaz,项目名称:expressomail,代码行数:30,代码来源:iCalcreator.class.php

示例15: toTree

 /**
  * Turn a list of rows into a tree
  *
  * @param   object  $rows
  * @return  array
  */
 public function toTree($rows)
 {
     $results = array();
     if ($rows->count() > 0) {
         $children = array(0 => array());
         foreach ($rows as $row) {
             $pt = $row->get('parent');
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $row);
             $children[$pt] = $list;
         }
         $results = $this->treeRecurse($children[0], $children);
     }
     return $results;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:21,代码来源:post.php


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