/**
  * Returns the content.
  */
 function objectAttributeContent($contentObjectAttribute)
 {
     $paexID = $contentObjectAttribute->attribute("contentobject_id");
     $paex = eZPaEx::fetch($paexID);
     return $paex;
 }
Esempio n. 2
0
 /**
  * Generate array of paex objects to update based on updatechildren status
  *
  * @param array $paex_to_update     Array of already updated paex objects
  * @return array of paex objects to update, with final values set.
  */
 function generateUpdateChildren($paexToUpdate = array())
 {
     eZDebug::writeDebug('Start', __METHOD__);
     if (!$this->attribute('updatechildren')) {
         eZDebug::writeDebug('UpdateChildren flag disabled. Nothing to do.', __METHOD__);
     } else {
         $newPasswordvalidationregexp = $this->attribute('passwordvalidationregexp');
         $newPasswordlifetime = $this->attribute('passwordlifetime');
         $newExpirationnotification = $this->attribute('expirationnotification');
         // Fetch the main node that belongs to the current paex
         $mainNodeID = eZContentObjectTreeNode::findMainNode($this->attribute('contentobject_id'));
         eZDebug::writeDebug('Going to update subtree starting at node ' . $mainNodeID . '.', __METHOD__);
         // Fetch the full subtree array to update
         $fullSubtree = eZContentObjectTreeNode::subTreeByNodeID(array("MainNodeOnly" => true, "AsObject" => false), $mainNodeID);
         foreach ($fullSubtree as $node) {
             // Fetch the paex for each node
             $addPaexToUpdate = eZPaEx::fetch($node["contentobject_id"]);
             // If the paex is not marked to updatechildren, update the paex object
             if ($addPaexToUpdate instanceof eZPaEx && $addPaexToUpdate->attribute('updatechildren') != 1) {
                 $addPaexToUpdate->setAttribute('passwordvalidationregexp', $newPasswordvalidationregexp);
                 $addPaexToUpdate->setAttribute('passwordlifetime', $newPasswordlifetime);
                 $addPaexToUpdate->setAttribute('expirationnotification', $newExpirationnotification);
                 $paexToUpdate[$node["contentobject_id"]] = $addPaexToUpdate;
             } else {
                 eZDebug::writeDebug('Skipping object ' . $add_paex_to_update->attribute('contentobject_id'), __METHOD__);
             }
         }
     }
     eZDebug::writeDebug('End', __METHOD__);
     return $paexToUpdate;
 }
Esempio n. 3
0
 /**
  * Unit test for eZPaEx::fetch()
  **/
 public function testFetch()
 {
     // Create a user
     $user = self::createUser(__FUNCTION__);
     $contentObjectID = $user->attribute('id');
     // Try fetching this user's ID. Should fail.
     $this->assertNull(eZPaEx::fetch($contentObjectID), "eZPaEx::fetch() should be null as the object hasn't been created yet");
     // Create & store the PaEx
     eZPaEx::create($contentObjectID)->store();
     // Try fetching it again
     $this->assertType('eZPaEx', eZPaEx::fetch($contentObjectID));
 }