Example #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);
            }
        }
    }
}
Example #2
0
 public function getReport()
 {
     // quick and dirty: use same data as for the web
     $tpl = sysInfoTools::eZTemplateFactory();
     $tpl->setVariable('title', 'Workflows Report');
     $workflows = eZWorkflow::fetchList();
     $triggers = eZTrigger::fetchList();
     $tpl->setVariable('workflows', $workflows);
     $tpl->setVariable('triggers', $triggers);
     $htmlReport = $tpl->fetch("design:sysinfo/workflowsreport.tpl");
     return $htmlReport;
 }
Example #3
0
 static function fetchLimited($moduleName, $functionName, $connectType)
 {
     $workflowArray = eZWorkflow::fetchList();
     $returnArray = array();
     foreach (array_keys($workflowArray) as $key) {
         if ($workflowArray[$key]->isAllowed($moduleName, $functionName, $connectType)) {
             $returnArray[] = $workflowArray[$key];
         }
     }
     return $returnArray;
 }
Example #4
0
    $workflowList[$workflow->attribute( 'id' )] = $workflow;
}
*/
$user = eZUser::currentUser();
$list_in_group = eZWorkflowGroupLink::fetchWorkflowList(0, $WorkflowGroupID, $asObject = true);
$workflow_list = eZWorkflow::fetchList();
$list = array();
foreach ($workflow_list as $workflow) {
    foreach ($list_in_group as $inGroup) {
        if ($workflow->attribute('id') === $inGroup->attribute('workflow_id')) {
            $list[] = $workflow;
        }
    }
}
$templist_in_group = eZWorkflowGroupLink::fetchWorkflowList(1, $WorkflowGroupID, $asObject = true);
$tempworkflow_list = eZWorkflow::fetchList(1);
$temp_list = array();
foreach ($tempworkflow_list as $tmpWorkflow) {
    foreach ($templist_in_group as $tmpInGroup) {
        if ($tmpWorkflow->attribute('id') === $tmpInGroup->attribute('workflow_id')) {
            $temp_list[] = $tmpWorkflow;
        }
    }
}
$Module->setTitle(ezpI18n::tr('kernel/workflow', 'Workflow list of group') . ' ' . $WorkflowGroupID);
$WorkflowgroupInfo = eZWorkflowGroup::fetch($WorkflowGroupID);
if (!$WorkflowgroupInfo) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$tpl = eZTemplate::factory();
$tpl->setVariable("temp_workflow_list", $temp_list);
Example #5
0
 * @package kernel
 */
$Module = $Params['Module'];
// $execStack = eZExecutionStack::instance();
// $execStack->clear();
// $execStack->addEntry( $Module->functionURI( 'list' ),
//                       $Module->attribute( 'name' ), 'list' );
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('NewGroupButton')) {
    return $Module->run('groupedit', array());
}
if ($http->hasPostVariable('NewWorkflowButton')) {
    return $Module->run('edit', array());
}
if ($http->hasPostVariable('DeleteButton') and $http->hasPostVariable('Workflow_id_checked')) {
    eZWorkflow::setIsEnabled(false, $http->postVariable('Workflow_id_checked'));
}
$groupList = eZWorkflowGroup::fetchList();
$workflows = eZWorkflow::fetchList();
$workflowList = array();
foreach ($workflows as $workflow) {
    $workflowList[$workflow->attribute('id')] = $workflow;
}
$Module->setTitle('Workflow list');
$tpl = eZTemplate::factory();
$tpl->setVariable('workflow_list', $workflowList);
$tpl->setVariable('group_list', $groupList);
$tpl->setVariable('module', $Module);
$Result = array();
$Result['content'] = $tpl->fetch('design:workflow/list.tpl');
$Result['path'] = array(array('url' => '/workflow/list/', 'text' => ezpI18n::tr('kernel/workflow', 'Workflow list')));
 function attribute($attr)
 {
     switch ($attr) {
         case 'sections':
             $sections = eZSection::fetchList(false);
             foreach ($sections as $key => $section) {
                 $sections[$key]['Name'] = $section['name'];
                 $sections[$key]['value'] = $section['id'];
             }
             return $sections;
             break;
         case 'languages':
             return eZContentLanguage::fetchList();
             break;
         case 'usergroups':
             $groups = eZPersistentObject::fetchObjectList(eZContentObject::definition(), array('id', 'name'), array('contentclass_id' => 3, 'status' => eZContentObject::STATUS_PUBLISHED), null, null, false);
             foreach ($groups as $key => $group) {
                 $groups[$key]['Name'] = $group['name'];
                 $groups[$key]['value'] = $group['id'];
             }
             return $groups;
             break;
         case 'contentclass_list':
             $classes = eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true, false, array('name' => 'asc'));
             $classList = array();
             for ($i = 0; $i < count($classes); $i++) {
                 $classList[$i]['Name'] = $classes[$i]->attribute('name');
                 $classList[$i]['value'] = $classes[$i]->attribute('id');
             }
             return $classList;
             break;
         case 'workflow_list':
             $workflows = eZWorkflow::fetchList();
             $workflowList = array();
             for ($i = 0; $i < count($workflows); $i++) {
                 $workflowList[$i]['Name'] = $workflows[$i]->attribute('name');
                 $workflowList[$i]['value'] = $workflows[$i]->attribute('id');
             }
             return $workflowList;
             break;
     }
     return eZWorkflowEventType::attribute($attr);
 }
 function attribute($attr)
 {
     switch ($attr) {
         case 'workflow_list':
             $workflows = eZWorkflow::fetchList();
             $workflowList = array();
             for ($i = 0; $i < count($workflows); $i++) {
                 $workflowList[$i]['Name'] = $workflows[$i]->attribute('name');
                 $workflowList[$i]['value'] = $workflows[$i]->attribute('id');
             }
             return $workflowList;
     }
     return eZWorkflowEventType::attribute($attr);
 }