public function get() { $message_id = Request::get('message_id', 'int'); if (empty($message_id)) { Output::error('Message Not Found'); } JS::set('chart.' . $this->id . '.params.message_id', ['value' => $message_id]); parent::get(); }
/** * The main page with options to send emails or tests. */ public function get() { $message_id = Request::get('id', 'int'); if (!$message_id || !($message = Database::getInstance()->selectRow('message', array('message_id' => $message_id)))) { Messenger::error('Message not found.'); return; } $template = Template::getInstance(); $template->set('content', 'mailing_send'); $template->set('message', $message); JS::set('message_id', $message['message_id']); JS::addSessionToken(); }
public function __construct() { parent::__construct(); JS::add('/js/Chart.min.js', false); JS::startup('lightning.stats.init()'); // Prepare the JS. JS::set('chart.' . $this->id . '.renderer', $this->renderer); JS::set('chart.' . $this->id . '.url', '/' . Request::getLocation()); JS::set('chart.' . $this->id . '.params.start', ['source' => 'start']); JS::set('chart.' . $this->id . '.params.number_format', $this->numberFormat); JS::set('chart.' . $this->id . '.params.diff', !empty($this->diff)); if (!empty($this->data)) { JS::set('chart.' . $this->id . '.data', $this->data); } JS::set('chart.' . $this->id . '.ajax', $this->ajax); }
public static function date($name, $settings = array()) { $content = Database::getInstance()->selectRow($settings['table'], array($settings['key'] => $settings['id']), array($settings['column'])); if ($content) { $value = $content[$settings['column']]; } else { $value = ''; } if (ClientUser::getInstance()->isAdmin()) { JS::startup('lightning.cms.initDate()'); JS::set('token', Session::getInstance()->getToken()); return '<img src="/images/lightning/pencil.png" class="cms_edit_date icon-16" id="cms_edit_' . $settings['id'] . '">' . '<img src="/images/lightning/save.png" class="cms_save_date icon-16" id="cms_save_' . $settings['id'] . '" style="display:none">' . '<span id="cms_' . $settings['id'] . '" style="display:none">' . Time::datePop('cms_' . $settings['id'], $value, 'true', 0) . '</span>' . '<input type="hidden" id="cms_key_' . $settings['id'] . '" value="' . $settings['key'] . '" />' . '<input type="hidden" id="cms_column_' . $settings['id'] . '" value="' . $settings['column'] . '" />' . '<input type="hidden" id="cms_table_' . $settings['id'] . '" value="' . $settings['table'] . '" />'; } else { return $value; } }
/** * Prepare the output and tell the template to render. */ public function output() { // Send globals to the template. $template = Template::getInstance(); if (!empty($this->page)) { $template->set('content', $this->page); } $template->set('google_analytics_id', Configuration::get('google_analytics_id')); // TODO: These should be called directly from the template. $template->set('errors', Messenger::getErrors()); $template->set('messages', Messenger::getMessages()); $template->set('site_name', Configuration::get('site.name')); $template->set('blog', Blog::getInstance()); JS::set('active_nav', $this->nav); $template->render($this->template); }
/** * Renders an 'upload image' button and a list of selected current images. * * @param $link_settings * * @return string */ protected function render_linked_table_editable_image(&$link_settings) { CKEditor::init(true); JS::startup('lightning.table.init()'); $link_settings['web_location'] = $this->getImageLocationWeb($link_settings, ''); JS::set('table.links.' . $link_settings['table'], $link_settings); $output = '<span class="button add_image" id="add_image_' . $link_settings['table'] . '">Add Image</span>'; $output .= '<span class="linked_images" id="linked_images_' . $link_settings['table'] . '">'; foreach ($link_settings['active_list'] as $image) { $output .= '<span class="selected_image_container"> <input type="hidden" name="linked_images_' . $link_settings['table'] . '[]" value="' . $image['image'] . '"> <span class="remove">X</span> <img src="' . $this->getImageLocationWeb($link_settings, $image['image']) . '"></span>'; } $output .= '</span>'; return $output; }
/** * Add a video's JS and CSS components. * This does not create the video's required HTML components. * * @param string $video_id * The ID for the video. * @param array $settings * The settings for the video. */ public static function add($video_id, $settings) { self::initDisplay(); JS::set('videos.' . $video_id, $settings); JS::startup('lightning.video.init()'); }