public function __construct() { $this->tour_data = HelpTour::getHelpbarTourData(); foreach ($this->tour_data['tours'] as $index => $tour) { $element = new LinkElement($tour->name, URLHelper::getURL('?tour_id=' . $tour->tour_id)); $visit_state = HelpTourUser::find(array($tour->tour_id, $GLOBALS['user']->id)); if ($visit_state === null) { $element->addClass('tour-new'); } elseif (!$visit_state->completed) { $element->addClass('tour-paused'); } else { $element->addClass('tour-completed'); } $element->addClass('tour_link'); $element['id'] = $tour->tour_id; $this->addElement($element); } }
/** * Administration page for tour conflicts */ function admin_conflicts_action() { // check permission if (!$GLOBALS['auth']->is_authenticated() || $GLOBALS['user']->id === 'nobody') { throw new AccessDeniedException(); } $GLOBALS['perm']->check('root'); // initialize PageLayout::setTitle(_('Versions-Konflikte der Touren')); PageLayout::setHelpKeyword('Basis.TourAdmin'); // set navigation Navigation::activateItem('/admin/config/tour'); // load help content $this->conflicts = HelpTour::GetConflicts(); $this->diff_fields = array('description' => _('Beschreibung'), 'studip_version' => _('Stud.IP-Version'), 'type' => _('Art der Tour'), 'roles' => _('Geltungsbereich')); $this->diff_step_fields = array('title' => _('Titel'), 'tip' => _('Inhalt'), 'interactive' => _('Interaktiv'), 'route' => _('Seite'), 'orientation' => _('Orientierung')); }
/** * fetches tour conflicts * * @return array set of tour objects */ public static function GetConflicts() { $conflicts = array(); $query = "SELECT tour_id AS idx, help_tours.*\n FROM help_tours\n WHERE installation_id = ?\n ORDER BY name ASC"; $statement = DBManager::get()->prepare($query); $statement->execute(array($GLOBALS['STUDIP_INSTALLATION_ID'])); $ret = $statement->fetchGrouped(PDO::FETCH_ASSOC); foreach ($ret as $index => $data) { $query = "SELECT tour_id AS idx, help_tours.*\n FROM help_tours\n WHERE global_tour_id = ? AND language = ? AND studip_version >= ? AND installation_id <> ?\n ORDER BY studip_version DESC LIMIT 1"; $statement = DBManager::get()->prepare($query); $statement->execute(array($data['global_tour_id'], $data['language'], $data['studip_version'], $GLOBALS['STUDIP_INSTALLATION_ID'])); $ret2 = $statement->fetchGrouped(PDO::FETCH_ASSOC); if (count($ret2)) { $conflicts[] = HelpTour::GetTourObjects(array_merge(array($index => $data), $ret2)); } } return $conflicts; }