Exemplo n.º 1
0
 /**
  * Gets the object associated to this ObjectFolder
  * @return Object - an instance of Object class
  */
 function getObject()
 {
     if ($this->object == null) {
         $objectMapper = new ObjectMapper();
         $this->object = $objectMapper->get($this->objectID);
     }
     return $this->object;
 }
Exemplo n.º 2
0
 /**
  * Gets the Object child
  * @return Object - object instance
  */
 function getChild()
 {
     if (is_null($this->child) == true) {
         $objectMapper = new ObjectMapper();
         $this->child = $objectMapper->get($this->getChildID());
     }
     return $this->child;
 }
Exemplo n.º 3
0
 /**
  * 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;
     }
 }
Exemplo n.º 4
0
        $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);
    }
}
?>