setOption() public method

Currently available options are:
'debug' - Output debugging information to screen
'forcecompile' - Force a compilation on every page load
'gettext' - Activate gettext detection
        
public setOption ( string $option, mixed $val )
$option string The option name.
$val mixed The option's value.
Exemplo n.º 1
0
 /**
  * $registry
  * $notification
  * $conf
  * $criteria
  *
  */
 public function run()
 {
     extract($this->_params, EXTR_REFS);
     $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
     /* Get requested channel. */
     try {
         $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($criteria['feed']);
     } catch (Exception $e) {
         Horde::log($e, 'ERR');
         $notification->push(_("Invalid channel."), 'horde.error');
         Horde::url('delivery/index.php', true)->redirect();
         exit;
     }
     $title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']);
     $options = array();
     foreach ($templates as $key => $info) {
         $options[] = '<option value="' . $key . '"' . ($key == $criteria['format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
     }
     $template = new Horde_Template();
     $template->setOption('gettext', 'true');
     $template->set('url', Horde::selfUrl());
     $template->set('session', Horde_Util::formInput());
     $template->set('channel_id', $criteria['feed']);
     $template->set('channel_name', $channel['channel_name']);
     $template->set('format', $criteria['format']);
     $template->set('options', $options);
     // @TODO: This is ugly. storage driver shouldn't be rendering any display
     // refactor this to use individual views possibly with a choice of different templates
     $template->set('stories', $GLOBALS['injector']->getInstance('Jonah_Driver')->renderChannel($criteria['feed'], $criteria['format']));
     // Buffer the notifications and send to the template
     Horde::startBuffer();
     $GLOBALS['notification']->notify(array('listeners' => 'status'));
     $template->set('notify', Horde::endBuffer());
     $GLOBALS['page_output']->header(array('title' => $title));
     echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
     $GLOBALS['page_output']->footer();
 }
Exemplo n.º 2
0
Arquivo: time.php Projeto: horde/horde
        $item = $vars->get('item');
        if (is_null($item) || !count($item)) {
            $notification->push(_("No timeslices were selected to submit."), 'horde.error');
        } else {
            foreach (array_keys($item) as $id) {
                $time[] = array('id' => $id);
            }
            try {
                $GLOBALS['injector']->getInstance('Hermes_Driver')->markAs('submitted', $time);
                $notification->push(_("Your time was successfully submitted."), 'horde.success');
                $vars = new Horde_Variables();
            } catch (Horde_Exception $e) {
                $notification->push(sprintf(_("There was an error submitting your time: %s"), $e->getMessage()), 'horde.error');
            }
        }
        break;
}
// We are displaying all time.
$tabs = Hermes::tabs();
$criteria = array('employee' => $GLOBALS['registry']->getAuth(), 'submitted' => false, 'link_page' => 'time.php');
$table = new Hermes_Table('week', $vars, array('title' => _("My Unsubmitted Time"), 'name' => 'hermes/hours', 'params' => $criteria));
$template = new Horde_Template();
$template->setOption('gettext', true);
$template->set('postUrl', Horde::url('time.php', false, -1));
$template->set('sessionId', Horde_Util::formInput());
$template->set('table', $table->render());
$page_output->header(array('title' => _("My Time")));
$notification->notify(array('listeners' => 'status'));
echo $tabs;
echo $template->fetch(HERMES_TEMPLATES . '/time/form.html');
$page_output->footer();
Exemplo n.º 3
0
Arquivo: feed.php Projeto: horde/horde
$options = array();
foreach ($templates as $key => $info) {
    $options[] = '<option value="' . $key . '"' . ($key == $criteria['channel_format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
}
if (empty($criteria['channel_id']) && !empty($criteria['feed'])) {
    $criteria['channel_id'] = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannelId($criteria['feed']);
}
if (empty($criteria['channel_id'])) {
    $notification->push(_("No valid feed name or ID requested."), 'horde.error');
} else {
    $stories = $GLOBALS['injector']->getInstance('Jonah_Driver')->getStories($criteria);
}
if (!empty($stories)) {
    die(print_r($stories, true));
}
$template = new Horde_Template();
$template->setOption('gettext', 'true');
$template->set('url', Horde::selfUrl());
$template->set('session', Horde_Util::formInput());
$template->set('channel_id', $criteria['channel_id']);
$template->set('channel_name', $channel['channel_name']);
$template->set('format', $criteria['channel_format']);
$template->set('options', $options);
$template->set('stories', $news->renderChannel($criteria['channel_id'], $criteria['channel_format']));
// Buffer the notifications and send to the template
Horde::startBuffer();
$GLOBALS['notification']->notify(array('listeners' => 'status'));
$template->set('notify', Horde::endBuffer());
$page_output->header();
echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
$page_output->footer();