本文整理匯總了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));
}