function questions_get_phases_array($group_id = 0) { static $result; if (!isset($result)) { $result = array(); $phases = questions_get_phases($group_id); foreach ($phases as $phase) { $result[$phase->guid] = $phase->name; } } return $result; }
<?php if ($manager = $question->getWorkflowManager()) { echo elgg_view("output/url", array("href" => $manager->getURL(), "text" => $manager->name)); } else { echo elgg_echo("questions:workflow:none"); } ?> </div> <div class="overview-element"> <?php if ($currentPhase = $question->getCurrentWorkflowPhase()) { echo $currentPhase->name; } else { if ($question->totalAnswerTimes) { echo end(questions_get_phases())->name; } else { echo elgg_echo("questions:workflow:none"); } } ?> </div> <div class="overview-element"> <?php if ($question->isWorkflowOpen()) { echo questions_get_friendly_timespan($question->getWorkflowLatestTotalTime()); } else { echo "-"; } ?>
/** * Open workflow for question and change phase to the first phase * * @return bool */ public function setWorkflowOpen() { if (!isset($this->currentPhase)) { $phases = questions_get_phases(); $this->currentPhase = current($phases)->guid; $this->setCurrentPhaseStart(); $this->workflowStart = time(); $this->workflowManager = elgg_get_logged_in_user_guid(); return true; } return false; }