Exemplo n.º 1
0
function removeSelectedGroups($http, &$groups, $base)
{
    if ($http->hasPostVariable("DeleteGroupButton")) {
        if (eZHTTPPersistence::splitSelected($base, $groups, $http, "id", $keepers, $rejects)) {
            $groups = $keepers;
            foreach ($rejects as $reject) {
                $group_id = $reject->attribute("id");
                // Remove all workflows in current group
                $list_in_group = eZWorkflowGroupLink::fetchWorkflowList(0, $group_id, $asObject = true);
                $workflow_list = eZWorkflow::fetchList();
                $list = array();
                foreach ($workflow_list as $workflow) {
                    foreach ($list_in_group as $group) {
                        $id = $workflow->attribute("id");
                        $workflow_id = $group->attribute("workflow_id");
                        if ($id === $workflow_id) {
                            $list[] = $workflow;
                        }
                    }
                }
                foreach ($list as $workFlow) {
                    eZTrigger::removeTriggerForWorkflow($workFlow->attribute('id'));
                    $workFlow->remove();
                }
                $reject->remove();
                eZWorkflowGroupLink::removeGroupMembers($group_id);
            }
        }
    }
}
Exemplo n.º 2
0
 /**
  * Fetches the HTTP post variables using the base name $base_name and stores
  * them in the object $objects, if $is_array is true then $objects is assumed
  * to be an array and all objects are updated.
  *
  * @param string $base_name Base name for HTTP POST variables
  * @param array $def Definition for $objects, uses the same syntax as {@link eZPersistentObject}
  * @param object|object[] Single object or array of objects having the same definition provided in $def
  * @param eZHTTPTool
  * @param bool $is_array If true, $objects is assumed to be an array
  * @param string|false $indexField Field name as defined in $def. If provided, will be used to fetch HTTP variables as index.
  * @return void
  */
 static function fetch($base_name, array $def, $objects, eZHTTPTool $http, $is_array, $indexField = false)
 {
     if ($is_array) {
         for ($i = 0, $iMax = count($objects); $i < $iMax; ++$i) {
             $object = $objects[$i];
             $index = is_string($indexField) ? $indexField : $i;
             eZHTTPPersistence::fetchElement($base_name, $def, $object, $http, $index);
         }
     } else {
         eZHTTPPersistence::fetchElement($base_name, $def, $objects, $http, false);
     }
 }
Exemplo n.º 3
0
    $user_id = $user->attribute("contentobject_id");
    $workflowGroup = eZWorkflowGroup::create($user_id);
    $workflowGroup->setAttribute("name", ezpI18n::tr('kernel/workflow/groupedit', "New WorkflowGroup"));
    $WorkflowGroupID = $workflowGroup->attribute("id");
}
//$assignedWorkflows = $workflowGroup->fetchWorkflowList();
//$isRemoveTried = false;
$http = eZHTTPTool::instance();
if ($http->hasPostVariable("DiscardButton")) {
    $Module->redirectTo($Module->functionURI("grouplist"));
    return;
}
// Validate input
$requireFixup = false;
// Apply HTTP POST variables
eZHTTPPersistence::fetch("WorkflowGroup", eZWorkflowGroup::definition(), $workflowGroup, $http, false);
// Set new modification date
$date_time = time();
$workflowGroup->setAttribute("modified", $date_time);
$user = eZUser::currentUser();
$user_id = $user->attribute("contentobject_id");
$workflowGroup->setAttribute("modifier_id", $user_id);
// Discard existing events, workflow version 1 and store version 0
if ($http->hasPostVariable("StoreButton")) {
    if ($http->hasPostVariable("WorkflowGroup_name")) {
        $name = $http->postVariable("WorkflowGroup_name");
    }
    $workflowGroup->setAttribute("name", $name);
    // Set new modification date
    $date_time = time();
    $workflowGroup->setAttribute("modified", $date_time);
 /**
  * Fetches the HTTP persistent variables for this content object state and its localizations.
  *
  * "ContentObjectState" is used as base name for the persistent variables.
  *
  * @see eZHTTPPersistence
  */
 public function fetchHTTPPersistentVariables()
 {
     $translations = $this->allTranslations();
     $http = eZHTTPTool::instance();
     eZHTTPPersistence::fetch('ContentObjectState', eZContentObjectState::definition(), $this, $http, false);
     eZHTTPPersistence::fetch('ContentObjectState', eZContentObjectStateLanguage::definition(), $translations, $http, true);
 }
Exemplo n.º 5
0
if ( $http->hasPostVariable( "DeleteButton" ) )
{
    if ( eZHTTPPersistence::splitSelected( "WorkflowEvent", $event_list, $http, "id", $keepers, $rejects ) )
    {
        $db = eZDB::instance();
        $db->begin();
        foreach ( $rejects as $reject )
        {
            $reject->remove();
        }
        $db->commit();
        $event_list = $keepers;
    }
}

eZHTTPPersistence::fetch( "Workflow", eZWorkflow::definition(),
                          $workflow, $http, false );
if ( $http->hasPostVariable( "WorkflowTypeString" ) )
    $cur_type = $http->postVariable( "WorkflowTypeString" );

// set temporary version to edited workflow
$workflow->setVersion( 1, $event_list );

// Set new modification date
$date_time = time();
$workflow->setAttribute( "modified", $date_time );
$user = eZUser::currentUser();
$user_id = $user->attribute( "contentobject_id" );
$workflow->setAttribute( "modifier_id", $user_id );


/********** Custom Action Code Start ***************/
Exemplo n.º 6
0
 /**
  * This function has some serious flaws and will be removed in a future release
  * Goes trough all fields defined in \a $def and tries to find a post variable
  * which is named \a $base_name, field name and "checked" with _ between items.
  * If the post variable is an array the id of the current object is matched against
  * that array, if one is found the matched field is set to be true otherwise false.
  * If no post variable was found with that signature the field is ignored.
  * Example of name:
  * <code>
  *   In the HTML code use:<br/>
  *   <input type="checkbox" name="ContentClassAttribute_is_searchable_checked[]" value="some_id" />
  * </code>
  *
  * @deprecated
  * @param string $base_name
  * @param array $def
  * @param object|object[] $objects
  * @param eZHTTPTool $http
  * @param bool $is_array
  */
 static function handleChecked( $base_name, array $def, $objects, eZHTTPTool $http, $is_array = true )
 {
     if ( $is_array )
     {
         foreach( $objects as $object )
         {
             eZHTTPPersistence::handleCheckedElement( $base_name, $def, $object, $http );
         }
     }
     else
     {
         eZHTTPPersistence::handleCheckedElement( $base_name, $def, $objects, $http );
     }
 }
Exemplo n.º 7
0
    foreach ($attributes as $attribute) {
        if ($customActionAttributeID == $attribute->attribute('id')) {
            $attribute->customHTTPAction($Module, $http, $customAction);
        }
    }
}
// Set new modification date
$date_time = time();
$class->setAttribute('modified', $date_time);
$user = eZUser::currentUser();
$user_id = $user->attribute('contentobject_id');
$class->setAttribute('modifier_id', $user_id);
// Remove attributes which are to be deleted
if ($http->hasPostVariable('RemoveButton')) {
    $validation['processed'] = true;
    if (eZHTTPPersistence::splitSelected('ContentAttribute', $attributes, $http, 'id', $keepers, $rejects)) {
        $attributes = $keepers;
        foreach ($rejects as $reject) {
            if (!$reject->removeThis(true)) {
                $dataType = $reject->dataType();
                $removeInfo = $dataType->classAttributeRemovableInformation($reject);
                if ($removeInfo !== false) {
                    $validation['attributes'] = array(array('id' => $reject->attribute('id'), 'identifier' => $reject->attribute('identifier'), 'reason' => $removeInfo));
                }
            }
        }
    }
}
// Fetch HTTP input
$datatypeValidation = array();
if ($contentClassHasInput) {
 public function fetchHTTPPersistentVariables()
 {
     $http = eZHTTPTool::instance();
     eZHTTPPersistence::fetch('ContentObjectNewsletterSubscriptionList', jajNewsletterSubscriptionList::definition(), $this, $http, false);
 }
Exemplo n.º 9
0
 static function handleChecked( $base_name,
                         /*! The definition of the objects, uses the same syntax as eZPersistentObject */
                         $def,
                         $objects,
                         $http,
                         $is_array = true )
 {
     if ( $is_array )
     {
         foreach( $objects as $object )
         {
             eZHTTPPersistence::handleCheckedElement( $base_name, $def, $object, $http );
         }
     }
     else
         eZHTTPPersistence::handleCheckedElement( $base_name, $def, $objects, $http );
 }