Exemplo n.º 1
0
 static function fetchList()
 {
     $result = array();
     $conditions = array();
     $limitation = null;
     $asObject = true;
     return eZPersistentObject::fetchObjectList(eZSurveyRelatedConfig::definition(), null, $conditions, null, $limitation, $asObject);
 }
Exemplo n.º 2
0
            }
            $config->setAttribute('contentclass_id', $classID);
            $config->store();
        }
    }
}
if ($http->hasPostVariable('SelectedNodeIDArray')) {
    $nodeIDArray = $http->postVariable('SelectedNodeIDArray');
    $nodeID = 0;
    if (count($nodeIDArray) > 0 and is_numeric($nodeIDArray[0])) {
        // update the database.
        $nodeID = $nodeIDArray[0];
        if ($config === false) {
            $configList = eZSurveyRelatedConfig::fetchList();
            if (count($configList) == 0) {
                $config = eZSurveyRelatedConfig::create();
            } else {
                $config = $configList[0];
            }
        }
        $config->setAttribute('node_id', $nodeID);
        $config->store();
    }
}
if ($Module->isCurrentAction('BrowseForObjects')) {
    $assignedNodesIDs = array();
    eZContentBrowse::browse(array('action_name' => 'AddRelatedSurveyNode', 'description_template' => 'design:content/browse_related.tpl', 'content' => array(), 'keys' => array(), 'ignore_nodes_select' => $assignedNodesIDs, 'from_page' => $Module->redirectionURI('survey', 'wizard', array())), $Module);
    return eZModule::HOOK_STATUS_CANCEL_RUN;
}
$tpl = eZTemplate::factory();
$tpl->setVariable('state', $state);
Exemplo n.º 3
0
 function createNewRelatedObject($http, $action, $objectAttribute, $parameters)
 {
     $hasClassInformation = false;
     $contentClassID = false;
     $contentClassIdentifier = false;
     $languageCode = false;
     $class = false;
     $languageCode = $objectAttribute->attribute('language_code');
     $originalContentObjectID = $objectAttribute->attribute('contentobject_id');
     $originalContentObjectVersion = $objectAttribute->attribute('version');
     $contentObject = false;
     $addVersion = false;
     if ($this->Num != 0) {
         $contentObject = eZContentObject::fetch($this->Num);
     }
     if ($this->Num == 0 or !(get_class($contentObject) == 'eZContentObject')) {
         $addVersion = true;
         $ini = eZINI::instance('ezsurvey.ini');
         $configList = eZSurveyRelatedConfig::fetchList();
         if (count($configList) > 0) {
             $config = $configList[0];
             $contentClassID = $config->attribute('contentclass_id');
             $contentClass = eZContentClass::fetch($contentClassID);
             $nodeID = $config->attribute('node_id');
             $attributeParentNode = eZContentObjectTreeNode::fetch($nodeID);
             if (get_class($contentClass) == 'eZContentClass' and get_class($attributeParentNode) == 'eZContentObjectTreeNode') {
                 $languageID = eZContentLanguage::idByLocale($languageCode);
                 $contentObject = eZContentObject::fetch($objectAttribute->attribute('contentobject_id'));
                 $node = eZContentObjectTreeNode::fetch($nodeID, $languageCode);
                 if (get_class($node) == "eZContentObjectTreeNode") {
                     $contentObject = eZContentObject::createWithNodeAssignment($node, $contentClassID, $languageCode, false);
                 } else {
                     eZDebug::writeWarning('node is not a valid eZContentObjectTreeNode', 'eZSurveyRelatedObject::createNewRelatedObject');
                 }
             } else {
                 eZDebug::writeWarning('Config is not valid', 'eZSurveyRelatedObject::createNewRelatedObject');
             }
         }
     }
     if ($contentObject) {
         $redirectHref = 'content/edit/' . $originalContentObjectID . '/' . $originalContentObjectVersion;
         $http->setSessionVariable('LastAccessesURI_Backup_' . $originalContentObjectID . '_' . $this->ID, array('content' => $http->sessionVariable('LastAccessesURI')));
         $http->setSessionVariable('RedirectURIAfterPublish_Backup_' . $originalContentObjectID . '_' . $this->ID, array('content' => $http->sessionVariable('RedirectURIAfterPublish')));
         $http->setSessionVariable('RedirectIfDiscarded_Backup_' . $originalContentObjectID . '_' . $this->ID, array('content' => $http->sessionVariable('RedirectIfDiscarded')));
         $http->setSessionVariable('LastAccessesURI', $redirectHref);
         $http->setSessionVariable('RedirectURIAfterPublish', $redirectHref);
         $http->setSessionVariable('RedirectIfDiscarded', $redirectHref);
         $this->Num = $contentObject->attribute('id');
         $this->store();
         $parameters = array($contentObject->attribute('id'));
         if ($addVersion === true) {
             $parameters[] = $contentObject->attribute('current_version');
         }
         $module = $GLOBALS['module'];
         $module->redirectToView('edit', $parameters);
     }
     return true;
 }