當前位置: 首頁>>代碼示例>>PHP>>正文


PHP core_kernel_classes_Class::countInstances方法代碼示例

本文整理匯總了PHP中core_kernel_classes_Class::countInstances方法的典型用法代碼示例。如果您正苦於以下問題:PHP core_kernel_classes_Class::countInstances方法的具體用法?PHP core_kernel_classes_Class::countInstances怎麽用?PHP core_kernel_classes_Class::countInstances使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在core_kernel_classes_Class的用法示例。


在下文中一共展示了core_kernel_classes_Class::countInstances方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getUserCount

 /**
  * returns the nr of users fullfilling the criterias,
  * uses the same syntax as getUsersByRole
  *
  * @access public
  * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
  * @param  array roles
  * @param  array options
  * @return int
  */
 public function getUserCount($roles, $options = array())
 {
     $returnValue = (int) 0;
     $opts = array('recursive' => true, 'like' => false);
     $crits = array(PROPERTY_USER_LOGIN => '*');
     if (isset($options['search']['string']) && isset($options['search']['op']) && !empty($options['search']['string']) && !empty($options['search']['op'])) {
         $fields = array('login' => PROPERTY_USER_LOGIN, 'password' => PROPERTY_USER_PASSWORD, 'uilg' => PROPERTY_USER_UILG, 'deflg' => PROPERTY_USER_DEFLG, 'mail' => PROPERTY_USER_MAIL, 'email' => PROPERTY_USER_MAIL, 'role' => RDF_TYPE, 'roles' => PROPERTY_USER_ROLES, 'firstname' => PROPERTY_USER_FIRSTNAME, 'lastname' => PROPERTY_USER_LASTNAME, 'name' => PROPERTY_USER_FIRSTNAME);
         $ops = array('eq' => "%s", 'bw' => "%s*", 'ew' => "*%s", 'cn' => "*%s*");
         $crits[$fields[$options['search']['field']]] = sprintf($ops[$options['search']['op']], $options['search']['string']);
     }
     $crits[PROPERTY_USER_ROLES] = $roles;
     $userClass = new core_kernel_classes_Class(CLASS_GENERIS_USER);
     $returnValue = $userClass->countInstances($crits, $opts);
     return (int) $returnValue;
 }
開發者ID:swapnilaptara,項目名稱:tao-aptara-assess,代碼行數:25,代碼來源:class.UserService.php

示例2: testLabelClassLookupTest

 public function testLabelClassLookupTest()
 {
     $class = new \core_kernel_classes_Class('http://www.test.com#mytestclass');
     $this->assertEquals(1, count($class->countInstances()));
 }
開發者ID:nagyist,項目名稱:extension-tao-itemqti,代碼行數:5,代碼來源:LabelClassLookupTest.php


注:本文中的core_kernel_classes_Class::countInstances方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。