本文整理汇总了PHP中Resources::getResourceNames方法的典型用法代码示例。如果您正苦于以下问题:PHP Resources::getResourceNames方法的具体用法?PHP Resources::getResourceNames怎么用?PHP Resources::getResourceNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resources
的用法示例。
在下文中一共展示了Resources::getResourceNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$hardware = Resources::getResourceTypes(Resources::HARDWARE_DB);
$employees = Resources::getResourceTypes(Resources::EMPLOYEE_DB);
$facilities = Resources::getResourceTypes(Resources::FACILITY_DB);
$customResources = new CustomResources();
$resourceAvailable = 1;
$projectId = $_GET['pid'];
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['create'])) {
$ecounter = 0;
$hcounter = 0;
$fcounter = 0;
$ccounter = 0;
foreach ($_POST as $key => $value) {
$resource = null;
$type = $key;
$type = substr($type, 0, 4);
if ($value['start_date'] != '') {
if ($type == 'Empl') {
$resource = new EmployeeSchedule();
$resource->attributes = $_POST[$key];
$resource->employee_id = EmployeeSchedule::findAvailableEmployeeResource(Resources::EMPLOYEE_DB, $resource->start_date, $resource->end_date, $value['name']);
$resource->pid = $projectId;
if ($resource->employee_id == 0) {
$resource = null;
$resourceAvailable = 0;
}
} elseif ($type == 'Hard') {
$resource = new HardwareSchedule();
$resource->attributes = $_POST[$key];
$resource->pid = $projectId;
$resourceAvailable = HardwareSchedule::findAvailableHardwareResource(Resources::HARDWARE_TYPES_DB, $resource->start_date, $resource->end_date, $value['name']);
if ($resourceAvailable == 0) {
$resource = null;
} else {
$resource->hardware_id = $resourceAvailable;
}
} elseif ($type == 'Faci') {
$resource = new FacilitySchedule();
$resource->attributes = $_POST[$key];
$resource->pid = $projectId;
$resourceAvailable = FacilitySchedule::findAvailableFacilityResource(Resources::FACILITY_TYPES_DB, $resource->start_date, $resource->end_date, $value['name']);
if ($resourceAvailable == 0) {
$resource = null;
} else {
$resource->facility_id = $resourceAvailable;
}
} elseif ($type == 'Cust') {
$resource = new CustomResources();
$resource->attributes = $_POST[$key];
$resource->pid = $projectId;
$resource->owner = Yii::app()->user->id;
$ccounter++;
}
if ($resource != null) {
$resource->save();
}
}
}
if ($resourceAvailable > 0) {
$this->redirect(array('project/view', 'id' => $projectId));
}
}
$employeeNames = Resources::getResourceNames(Resources::EMPLOYEE_DB);
$this->render('create', array('employees' => $employees, 'employeeNames' => $employeeNames, 'hardware' => $hardware, 'facilities' => $facilities, 'customResources' => $customResources));
}