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


PHP Resources::getResourceIdByName方法代码示例

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


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

示例1: findAvailableHardwareResource

 public static function findAvailableHardwareResource($resourceDb, $start, $end, $name)
 {
     //CHECK WETHER THERE IS A RESOURCE OF TYPE $type LEFT (COUNT $booked AGAINST $available???
     // NEEDED:
     //  -NR. OF RESOURCES OF TYPE $type
     //  -NR OF RESOUCRES LEFT AFTER SUBTRACTING $booked
     //  -ASSIGN A RESOURCE_ID IF POSSIBLE
     $hid = 0;
     $id = Resources::getResourceIdByName($name, $resourceDb);
     $numberOfResources = HardwareSchedule::getNrOfAvailableResources($id);
     $reservedResources = HardwareSchedule::getNrOfReservedHardwareResources($start, $end, $id);
     if ($numberOfResources - $reservedResources > 0) {
         $hid = HardwareSchedule::getBookableHardwareResources($start, $end, $id);
     } else {
         $error = Yii::app()->clientScript;
         $error->registerScript('error', 'alert("No resource ' . $name . ' Available!");', CClientScript::POS_READY);
     }
     return $hid;
 }
开发者ID:rknox,项目名称:PPM-App,代码行数:19,代码来源:HardwareSchedule.php

示例2: actionAdd

 /**
  * Creates a new Resource.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @param $type
  */
 public function actionAdd($type)
 {
     if ($type == 'employee') {
         $model = new Employees();
     } else {
         if ($type == 'hardware') {
             $model = new Hardware();
         } else {
             if ($type == 'facilities') {
                 $model = new Facilities();
             }
         }
     }
     if (isset($_POST['Employees']) || isset($_POST['Hardware']) || isset($_POST['Facilities'])) {
         if (get_class($model) == Employees) {
             $model->attributes = $_POST['Employees'];
             $model->e_type = Resources::getResourceIdByName($_POST['Employees']['e_type'], Resources::EMPLOYMENT_TYPES_DB);
         } else {
             if (get_class($model) == Hardware) {
                 $model->attributes = $_POST['Hardware'];
                 $model->h_type = Resources::getResourceIdByName($_POST['Hardware']['h_type'], Resources::HARDWARE_TYPES_DB);
             } else {
                 if (get_class($model) == Facilities) {
                     $model->attributes = $_POST['Facilities'];
                     $model->f_type = Resources::getResourceIdByName($_POST['Facilities']['f_type'], Resources::FACILITY_TYPES_DB);
                 }
             }
         }
         if ($model->save()) {
             $this->redirect(array('/resources'));
         }
     } else {
         $this->render('createResource', array('model' => $model));
     }
 }
开发者ID:rknox,项目名称:PPM-App,代码行数:40,代码来源:ResourcesController.php


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