本文整理汇总了PHP中Action::PUBLISH_OBJECTS_ACTION方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::PUBLISH_OBJECTS_ACTION方法的具体用法?PHP Action::PUBLISH_OBJECTS_ACTION怎么用?PHP Action::PUBLISH_OBJECTS_ACTION使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::PUBLISH_OBJECTS_ACTION方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Criteria
/**
* Gets the pending objects for the user, these are the ones that
* aren't published and the user can publish
*
* @return Array - An array of object objects
*/
function &findPending()
{
$query = $this->newQueryObject();
/* @var $query Query */
$criteria = new Criteria($query, "isPublished", "0");
$query->setCriterion($criteria);
$objectArray = $this->mapAll($query->execute());
// Permissions filter
$allowedObjectArray = array();
foreach ($objectArray as $object) {
if ($object->canDoAction(null, Action::PUBLISH_OBJECTS_ACTION()) == false) {
continue;
}
array_push($allowedObjectArray, $object);
}
return $allowedObjectArray;
}
示例2: update
/**
* Updates the object sent by HTTP
*/
function update()
{
$save = false;
$object = $this->collectObject($this->object);
// If there was an error, do not try to save
if ($object == null) {
$this->showUpdateView(true);
return;
}
$saveIt = true;
$om = new ObjectMapper();
$prevObject = $om->get($object->getId());
if ($object->getIsPublished() != $prevObject->getIsPublished()) {
//check publishing permissions
$canPublish = $object->canDoAction(null, Action::PUBLISH_OBJECTS_ACTION());
if (!$canPublish) {
$saveIt = false;
}
}
if ($saveIt) {
// Update !!
$objectService = ObjectServiceFactory::newInstance($object->getClass());
$objectService->update($object);
// Everything went all right, display view
$this->redirectToReferer();
} else {
//send error message
$controllerMessage = new ControllerMessage($this->text["notenoughpermissionstopublish"], ControllerMessage::getErrorType());
array_push($this->controllerMessageArray, $controllerMessage);
$this->showView(true);
return;
}
}
示例3: FolderClassMapper
$folderClassMapper = new FolderClassMapper();
$objectMapper = new ObjectMapper();
// Gets all folders for selected class for the folder combo
$foldersClasses = $folderClassMapper->findByClassId($id);
$folders = array();
$titles = array();
foreach ($foldersClasses as $folderClass) {
$folder = $folderClass->getFolder();
$text = $folder->getId() . "|" . $folder->getPathway();
array_push($folders, $text);
array_push($titles, $folder->getPathway());
}
$folders = $objectMapper->quicksortObjectByTitle($folders, $titles);
$json = new JSON();
echo $json->encode($folders);
}
}
if ($_GET['action'] == 'hasPublishingPermissions') {
$id = $_GET['id'];
if (is_numeric($id)) {
$objectMapper = new ObjectMapper();
$object = $objectMapper->get($id);
$rv = $object->canDoAction(null, Action::PUBLISH_OBJECTS_ACTION());
$json = new JSON();
echo $json->encode($rv);
}
}
?>