Esempio n. 1
0
<?php

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
if (Current_User::isLogged()) {
    $key = Key::getCurrent(true);
    if ($key) {
        $qr_func = function ($key_id, $size) {
            $qr = new QR($key_id);
            $qr->setSize($size);
            $image = $qr->get();
            return '<a download="QR-image.png" href="' . $qr->image . '">' . $qr->get() . '</a>';
        };
        $tpl_vars['small'] = $qr_func($key->id, 5);
        $tpl_vars['medium'] = $qr_func($key->id, 6);
        $tpl_vars['large'] = $qr_func($key->id, 8);
        $tpl_vars['xlarge'] = $qr_func($key->id, 12);
        $tpl = new \Template($tpl_vars);
        $tpl->setModuleTemplate('qr', 'modal.html');
        $content = $tpl->get();
        $modal = new Modal('qr-modal', $content, 'QR Codes (click to download)');
        $modal->sizeLarge();
        Layout::add($modal->get());
        MiniAdmin::add('qr', '<a data-toggle="modal" data-target="#qr-modal" class="pointer">Show QR codes</a>');
    }
}
Esempio n. 2
0
 public function scheduleListing()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('calendar', 'Schedule.php');
     require_once PHPWS_SOURCE_DIR . 'mod/calendar/class/Event.php';
     self::includeScheduleJS();
     self::includeEventJS();
     $schedule = new Calendar_Schedule();
     $schedule->id = 1;
     $this->title = dgettext('calendar', 'Schedules');
     $event = new Calendar_Event(0, $schedule);
     $page_tags['EVENT_FORM'] = self::eventModal($event);
     $page_tags['DESCRIPTION_LABEL'] = dgettext('calendar', 'Description');
     $page_tags['PUBLIC_LABEL'] = dgettext('calendar', 'Public');
     $page_tags['DISPLAY_NAME_LABEL'] = dgettext('calendar', 'User');
     $page_tags['AVAILABILITY_LABEL'] = dgettext('calendar', 'Availability');
     $page_tags['ADD_CALENDAR'] = '<button id="create-schedule" class="btn btn-success"><i class="fa fa-file-text"></i> ' . dgettext('calendar', 'Create schedule') . '</button>';
     $schedule_form = $this->calendar->schedule->form();
     $schedule_modal = new \Modal('schedule-modal', $schedule_form, 'Create schedule');
     $schedule_modal->sizeLarge();
     $page_tags['SCHEDULE_FORM'] = $schedule_modal->__toString();
     $page_tags['ADMIN_LABEL'] = dgettext('calendar', 'Options');
     $pager = new DBPager('calendar_schedule', 'Calendar_Schedule');
     $pager->setModule('calendar');
     $pager->setTemplate('admin/schedules.tpl');
     $pager->addPageTags($page_tags);
     $pager->addRowTags('rowTags');
     $pager->addToggle('class="bgcolor1"');
     $pager->setEmptyMessage(dgettext('calendar', 'No schedules have been created.'));
     $pager->addSortHeader('title', dgettext('calendar', 'Title'));
     $pager->addSortHeader('public', dgettext('calendar', 'Availability'));
     $pager->db->addWhere('user_id', 0);
     $pager->db->addWhere('user_id', 'users.id', '=', 'or');
     $pager->db->addColumn('*');
     $pager->db->addColumn('users.display_name');
     $pager->db->addJoin('left', 'calendar_schedule', 'users', 'user_id', 'id');
     $pager->initialize();
     $this->content = $pager->get();
 }
Esempio n. 3
0
 public static function arrangeForm()
 {
     $vars['action'] = 'admin';
     $template['MOVE_BOXES'] = '<button class="btn btn-primary" id="move-boxes">Move boxes</button>';
     $template['MOVE_BOXES_DESC'] = dgettext('layout', 'Allows you to shift content to other area of your layout. Movement options depend on the current theme.');
     $vars['command'] = 'reset_boxes';
     $template['RESET_BOXES'] = PHPWS_Text::secureLink(dgettext('layout', 'Reset boxes'), 'layout', $vars, null, null, 'btn btn-primary');
     $template['RESET_DESC'] = dgettext('layout', 'Resets all content back to its original location. Use if problems with Box Move occurred.');
     $vars['command'] = 'clear_templates';
     $template['CLEAR_TEMPLATES'] = PHPWS_Text::secureLink(dgettext('layout', 'Clear templates'), 'layout', $vars, null, null, 'btn btn-primary');
     $template['CLEAR_TEMPLATES_DESC'] = dgettext('layout', 'Removes all files from the current template cache directory. Good to try if your theme is not displaying properly.');
     $vars['command'] = 'clear_cache';
     $template['CLEAR_CACHE'] = PHPWS_Text::secureLink(dgettext('layout', 'Clear cache'), 'layout', $vars, null, null, 'btn btn-primary');
     $template['CLEAR_CACHE_DESC'] = dgettext('layout', 'Clears all Cache Lite files. Good to try if module updates do not display.');
     javascript('jquery');
     $script = '<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'mod/layout/javascript/move_boxes.js"></script>';
     \Layout::addJSHeader($script, 'moveboxes');
     $modal = new \Modal('box-move', '', 'Move boxes');
     $modal->sizeLarge();
     $template['MODAL'] = $modal->get();
     return PHPWS_Template::process($template, 'layout', 'arrange.tpl');
 }