本文整理匯總了PHP中Tracker::permissionsAreCached方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tracker::permissionsAreCached方法的具體用法?PHP Tracker::permissionsAreCached怎麽用?PHP Tracker::permissionsAreCached使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tracker
的用法示例。
在下文中一共展示了Tracker::permissionsAreCached方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveObject
/**
* Saves a Tracker object into the DataBase
*
* @param Tracker $tracker object to save
* @return int id of the newly created tracker
*/
public function saveObject($tracker)
{
// create tracker
$tracker_id = $this->getDao()->create($tracker->group_id, $tracker->name, $tracker->description, $tracker->item_name, $tracker->allow_copy, $tracker->submit_instructions, $tracker->browse_instructions, '', '', $tracker->instantiate_for_new_projects, $tracker->stop_notification);
if ($tracker_id) {
$trackerDB = $this->getTrackerById($tracker_id);
//create cannedResponses
$response_factory = $tracker->getCannedResponseFactory();
foreach ($tracker->cannedResponses as $response) {
$response_factory->saveObject($tracker_id, $response);
}
//create formElements
foreach ($tracker->formElements as $formElement) {
// these fields have no parent
Tracker_FormElementFactory::instance()->saveObject($trackerDB, $formElement, 0);
}
//create report
foreach ($tracker->reports as $report) {
Tracker_ReportFactory::instance()->saveObject($tracker_id, $report);
}
//create semantics
if (isset($tracker->semantics)) {
foreach ($tracker->semantics as $semantic) {
Tracker_SemanticFactory::instance()->saveObject($semantic, $trackerDB);
}
}
//create workflow
if (isset($tracker->workflow)) {
WorkflowFactory::instance()->saveObject($tracker->workflow, $trackerDB);
}
//tracker permissions
if ($tracker->permissionsAreCached()) {
$pm = PermissionsManager::instance();
foreach ($tracker->getPermissions() as $ugroup => $permissions) {
foreach ($permissions as $permission) {
$pm->addPermission($permission, $tracker_id, $ugroup);
}
}
} else {
$this->saveTrackerDefaultPermission($tracker_id);
}
$this->postCreateActions($trackerDB);
}
return $tracker_id;
}