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


PHP Action::PUBLISH_OBJECTS_ACTION方法代码示例

本文整理汇总了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;
 }
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:23,代码来源:objectMapper.php

示例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;
     }
 }
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:36,代码来源:addController.php

示例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);
    }
}
?>


开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:28,代码来源:irequest.php


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