/** main entry point for tools (called from /program/main_admin.php)
 *
 * this routine dispatches the tasks, If the specified task
 * is not recognised, the default task TASK_TOOLS_INTRO
 * is executed.
 *
 * @param object &$output collects the html output
 * @return void results are returned as output in $output
 * @todo fix permissions for backup tool! perhaps another bit?
 */
function job_tools(&$output)
{
    global $CFG, $WAS_SCRIPT_NAME, $USER;
    $output->set_helptopic('tools');
    $task = get_parameter_string('task', TASK_TOOLS_INTRO);
    switch ($task) {
        case TASK_TOOLS_INTRO:
            show_tools_intro($output);
            show_tools_menu($output);
            break;
        case TASK_TRANSLATETOOL:
            if ($USER->has_job_permissions(JOB_PERMISSION_TRANSLATETOOL)) {
                include $CFG->progdir . '/lib/translatetool.class.php';
                $mgr = new TranslateTool($output);
                if ($mgr->show_parent_menu()) {
                    show_tools_menu($output, $task);
                }
            } else {
                $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>");
                $output->add_content(t('job_access_denied', 'admin'));
                $output->add_message(t('job_access_denied', 'admin'));
                show_tools_menu($output, $task);
            }
            break;
        case TASK_BACKUPTOOL:
            if ($USER->has_job_permissions(JOB_PERMISSION_BACKUPTOOL)) {
                task_backuptool($output);
            } else {
                $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>");
                $output->add_content(t('job_access_denied', 'admin'));
                $output->add_message(t('job_access_denied', 'admin'));
                show_tools_menu($output, $task);
            }
            break;
        case TASK_LOGVIEW:
            if ($USER->has_job_permissions(JOB_PERMISSION_LOGVIEW)) {
                task_logview($output);
            } else {
                $output->add_content("<h2>" . t('access_denied', 'admin') . "</h2>");
                $output->add_content(t('job_access_denied', 'admin'));
                $output->add_message(t('job_access_denied', 'admin'));
                show_tools_menu($output, $task);
            }
            break;
        default:
            $s = utf8_strlen($task) <= 50 ? $task : utf8_substr($task, 0, 44) . ' (...)';
            $message = t('task_unknown', 'admin', array('{TASK}' => htmlspecialchars($s)));
            $output->add_message($message);
            logger('tools: unknown task: ' . htmlspecialchars($s));
            show_tools_intro($output);
            show_tools_menu($output);
            break;
    }
}
Example #2
0
 public static function loadLanguage($language, $file)
 {
     $languages = self::getLanguages();
     if (!isset($languages[$language])) {
         $language = self::$_defaultLanguage;
     }
     self::$_language = $language;
     if (isset($languages[$language]) && file_exists(dirname(__FILE__) . '/' . $language . '-' . $languages[$language] . '.xml')) {
         $xml = simplexml_load_file(dirname(__FILE__) . '/' . $language . '-' . $languages[$language] . '.xml');
         self::$_translations = array();
         foreach ($xml as $set) {
             $setAttr = $set->attributes();
             $setName = isset($setAttr['name']) ? $setAttr['name'] : 'default';
             if (!isset($setAttr['filename']) || $setAttr['filename'] == $file) {
                 foreach ($set as $translation) {
                     self::$_translations[(string) $setName][(string) $translation->base] = $translation->local;
                 }
             }
         }
     }
     return self::$_language;
 }
Example #3
0
		<title>' . COMPANY_TITLE . '</title>
		<link href="http://cdnjs.cloudflare.com/ajax/libs/uikit/1.2.0/css/uikit.gradient.min.css" rel="stylesheet" type="text/css">
		<link href="style.css" rel="stylesheet" type="text/css">
		<link href="styles/custom.css" rel="stylesheet" type="text/css">
	</head>

	<body>
		<div class="uk-container uk-container-center">
			<div class="uk-grid">
				<div id="navigation" class="uk-width-medium-1-4">
					<h1 class="nav-header">' . COMPANY_TITLE . '</h1>
					<a class="nav-header" href="http://' . parseLink(COMPANY_WEBSITE) . '">' . trim(parseLink(COMPANY_WEBSITE), "/") . '</a>
					<ul class="uk-nav uk-nav-side">';
if (count(TranslateTool::getLanguages()) > 1) {
    echo '<li class="language-select"><a>' . tl('Language: ') . '<select onchange="document.location = \'index.php?l=\'+ this.value;">';
    foreach (TranslateTool::getLanguages() as $tag => $name) {
        echo '<option value="' . $tag . '" ' . ($tag == $language ? 'selected' : '') . '>' . htmlspecialchars($name) . '</option>';
    }
    echo '</select></a></li>';
    echo '<li class="uk-nav-divider"></li>';
}
echo '					<li><a href="#factsheet">' . tl('Factsheet') . '</a></li>
						<li><a href="#description">' . tl('Description') . '</a></li>
						<li><a href="#history">' . tl('History') . '</a></li>
						<li><a href="#projects">' . tl('Projects') . '</a></li>
						<li><a href="#trailers">' . tl('Videos') . '</a></li>
						<li><a href="#images">' . tl('Images') . '</a></li>
						<li><a href="#logo">' . tl('Logo & Icon') . '</a></li>';
if (count($awards) > 0) {
    echo '<li><a href="#awards">' . tl('Awards & Recognition') . '</a></li>';
}