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


PHP CCompany::overrideDatabase方法代码示例

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


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

示例1: getFilteredDepartmentList

 public function getFilteredDepartmentList($notUsed = null, $deptType = -1, $searchString = '', $ownerId = 0, $orderby = 'dept_name', $orderdir = 'ASC')
 {
     $q = $this->_getQuery();
     $q->addTable('departments');
     $q->addQuery('departments.*, count(distinct p.project_id) as countp, count(distinct p2.project_id) as inactive');
     $q->addJoin('project_departments', 'pd', 'pd.department_id = dept_id');
     $q->addJoin('projects', 'p', 'pd.project_id = p.project_id AND p.project_active = 1');
     $q->addJoin('projects', 'p2', 'pd.project_id = p2.project_id AND p2.project_active = 0');
     $q->addGroup('dept_id');
     $q->addOrder('dept_name');
     $oCpy = new CCompany();
     $oCpy->overrideDatabase($this->_query);
     $where = $oCpy->getAllowedSQL($this->_AppUI->user_id, 'dept_company');
     $q->addWhere($where);
     $q = $this->setAllowedSQL($this->_AppUI->user_id, $q);
     if ($deptType > -1) {
         $q->addWhere('dept_type = ' . (int) $deptType);
     }
     if ($searchString != '') {
         $q->addWhere("dept_name LIKE '%{$searchString}%'");
     }
     if ($ownerId > 0) {
         $q->addWhere('dept_owner = ' . $ownerId);
     }
     $q->addGroup('dept_id');
     $orderby = property_exists($this, $orderby) || in_array($orderby, array('countp', 'inactive')) ? $orderby : 'dept_name';
     $q->addOrder($orderby . ' ' . $orderdir);
     return $q->loadList();
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:29,代码来源:departments.class.php

示例2: getStructuredProjects

 public function getStructuredProjects($active_only = false)
 {
     //global $st_projects_arr;
     $st_projects = array(0 => '');
     $q = $this->getQuery();
     $q->addTable('projects');
     $q->addJoin('companies', '', 'projects.project_company = company_id', 'inner');
     $q->addQuery('DISTINCT(projects.project_id), project_name, project_parent, project_company');
     if ($this->project_original_parent) {
         $q->addWhere('project_original_parent = ' . (int) $this->project_original_parent);
     }
     if ($this->project_status >= 0) {
         $q->addWhere('project_status = ' . (int) $this->project_status);
     }
     if ($active_only) {
         $q->addWhere('project_active = 1');
     }
     $q->addOrder('project_start_date, project_end_date');
     $obj = new CCompany();
     $obj->overrideDatabase($this->_query);
     $q = $obj->setAllowedSQL($this->_AppUI->user_id, $q);
     $dpt = new CDepartment();
     $dpt->overrideDatabase($this->_query);
     $q = $dpt->setAllowedSQL($this->_AppUI->user_id, $q);
     $q->leftJoin('project_departments', 'pd', 'pd.project_id = projects.project_id');
     $q->leftJoin('departments', 'd', 'd.dept_id = pd.department_id');
     $st_projects = $q->loadList();
     $tnums = count($st_projects);
     for ($i = 0; $i < $tnums; $i++) {
         $st_project = $st_projects[$i];
         if ($st_project['project_parent'] == $st_project['project_id']) {
             $this->show_st_project($st_project);
             $this->find_proj_child($st_projects, $st_project['project_id']);
         }
     }
     return $this->st_projects_arr;
 }
开发者ID:victorrod,项目名称:web2project,代码行数:37,代码来源:projects.class.php

示例3: getAllocation

 /**
  * 	Calculate the extent of utilization of user assignments
  * 	@param string hash	 a hash for the returned hashList
  * 	@param array users	 an array of user_ids calculating their assignment capacity
  * 	@return array		 returns hashList of extent of utilization for assignment of the users
  */
 public function getAllocation($hash = null, $users = null, $get_user_list = false)
 {
     /*
      * TODO: The core of this function has been simplified to always return 100%
      * free capacity available.  The allocation checking (aka resource
      * management) is a complex subject which is currently not even close to be
      * handled properly.
      */
     if (!w2PgetConfig('check_overallocation', false)) {
         if ($get_user_list) {
             $users_list = w2PgetUsersHashList();
             foreach ($users_list as $key => $user) {
                 $users_list[$key]['userFC'] = $user['contact_name'];
             }
             $hash = $users_list;
         } else {
             $hash = array();
         }
     } else {
         $q = $this->_getQuery();
         // retrieve the systemwide default preference for the assignment maximum
         $q->addTable('user_preferences');
         $q->addQuery('pref_value');
         $q->addWhere('pref_user = 0 AND pref_name = \'' . TASKASSIGNMAX . '\'');
         $sysChargeMax = $q->loadHash();
         $q->clear();
         if (!$sysChargeMax) {
             $scm = 0;
         } else {
             $scm = $sysChargeMax['pref_value'];
         }
         /*
          * provide actual assignment charge, individual chargeMax
          * and freeCapacity of users' assignments to tasks
          */
         $q->addTable('users', 'u');
         $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact', 'inner');
         $q->leftJoin('user_tasks', 'ut', 'ut.user_id = u.user_id');
         $q->leftJoin('user_preferences', 'up', 'up.pref_user = u.user_id');
         $q->addWhere("up.pref_name = 'TASKASSIGNMAX'");
         $q->addQuery('u.user_id, CONCAT(CONCAT_WS(\' [\', contact_display_name, IF(IFNULL((IFNULL(up.pref_value, ' . $scm . ') - SUM(ut.perc_assignment)), up.pref_value) > 0, IFNULL((IFNULL(up.pref_value, ' . $scm . ') - SUM(ut.perc_assignment)), up.pref_value), 0)), \'%]\') AS userFC, IFNULL(SUM(ut.perc_assignment), 0) AS charge');
         $q->addQuery('u.user_username, IFNULL(up.pref_value,' . $scm . ') AS chargeMax');
         $q->addQuery('IFNULL(up.pref_value, ' . $scm . ') AS freeCapacity');
         if (!empty($users)) {
             // use userlist if available otherwise pull data for all users
             $q->addWhere('u.user_id IN (' . implode(',', $users) . ')');
         }
         $q->addGroup('u.user_id');
         $q->addOrder('contact_first_name, contact_last_name');
         // get CCompany() to filter by company
         $obj = new CCompany();
         $obj->overrideDatabase($this->_query);
         $companies = $obj->getAllowedSQL($this->_AppUI->user_id, 'company_id');
         $q->addJoin('companies', 'com', 'company_id = contact_company');
         if ($companies) {
             $q->addWhere('(' . implode(' OR ', $companies) . ' OR contact_company=\'\' OR contact_company IS NULL OR contact_company = 0)');
         }
         $dpt = new CDepartment();
         $dpt->overrideDatabase($this->_query);
         $depts = $dpt->getAllowedSQL($this->_AppUI->user_id, 'dept_id');
         $q->addJoin('departments', 'dep', 'dept_id = contact_department');
         if ($depts) {
             $q->addWhere('(' . implode(' OR ', $depts) . ' OR contact_department=0)');
         }
         $hash = $q->loadHashList($hash);
         $q->clear();
     }
     return $hash;
 }
开发者ID:victorrod,项目名称:web2project,代码行数:75,代码来源:tasks.class.php

示例4: getCompanyName

 /**
  * @deprecated
  */
 public function getCompanyName()
 {
     trigger_error("getCompanyName has been deprecated and will be removed in v4.0. Please use getCompanyDetails() instead.", E_USER_NOTICE);
     $company = new CCompany();
     $company->overrideDatabase($this->_query);
     $company->load((int) $this->contact_company);
     return $company->company_name;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:11,代码来源:contacts.class.php

示例5: testDelete

 /**
  * Tests the delete of a company
  */
 public function testDelete()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $original_id = $this->obj->company_id;
     $result = $this->obj->delete();
     $item = new CCompany();
     $item->overrideDatabase($this->mockDB);
     $this->mockDB->stageHash(array('company_name' => '', 'company_owner' => ''));
     $item->load($original_id);
     $this->assertEquals('', $item->company_name);
     $this->assertEquals('', $item->company_owner);
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:17,代码来源:CCompaniesTest.php


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