Example #1
0
 /**
  * database function.
  * 
  * @access public
  * @return void
  */
 public function database()
 {
     $this->output->enable_profiler(true);
     $this->load->database();
     $this->load->dbutil();
     $this->load->dbforge();
     $data['title'] = $this->system_model->get('app_name');
     $data['breadcrumbs'] = array(array('data' => anchor('/', $this->system_model->get('app_name')), 'mode' => 'unavailable'), array('data' => anchor('install', ucfirst(lang('install'))), 'mode' => 'unavailable'), array('data' => anchor('install/database', ucfirst(lang('install') . ' ' . lang('database'))), 'mode' => 'current'));
     $html = heading(ucfirst(lang('install')) . ' ' . lang('database'), 1);
     $current = $this->migration->current();
     if (is_null($current)) {
         $html .= div($this->migration->error_string(), 'alert-box error');
     } else {
         $html .= div('Klubb database version: ' . $current, 'alert-box success');
     }
     $tables = $this->db->list_tables();
     foreach ($tables as $table) {
         $fields = $this->db->list_fields($table);
         array_unshift($fields, strong('Fält:'));
         $fields = ul($fields, array('class' => 'inline-list'));
         $html .= div(heading('Tabell: ' . $table, 4) . $fields, 'radius panel');
     }
     $data['html'] = $html;
     $this->system_model->view('template', $data);
 }
Example #2
0
function plug_connectors($p, $o)
{
    $rid = 'plg' . randid();
    $bt = connectors_menu($p, $o, $rid);
    $ret = connectors_j($p, $o);
    return $bt . div(atd($rid), $ret);
}
Example #3
0
 static function slide($r, $p, $rid)
 {
     $j = $rid . '_class___toposlides_j_';
     $v = $r[$p];
     if ($v[0]) {
         $bt1 = lj('', $j . $v[0] . '_' . $rid . '_inp', pictxt('left', $v[0])) . ' ';
     }
     //parent
     if ($v[2]) {
         $bt3 = lj('', $j . $v[2] . '_' . $rid . '_inp', pictxt('down', $v[2])) . ' ';
     }
     //end
     foreach ($r as $ka => $va) {
         if ($va[2] == $p) {
             $bt2 = lj('', $j . $ka . '_' . $rid . '_inp', pictxt('up', $ka)) . ' ';
         }
         //begin
         if ($va[0] == $p) {
             $bt4 .= lj('', $j . $ka . '_' . $rid . '_inp', pictxt('right', $ka)) . ' ';
         }
     }
     $bt = divc('', $bt1 . $bt2 . $bt3 . $bt4 . $bt0);
     //$cell=div(atc('imgl').ats('width:36px'),$bt1.$bt2.$bt3.$bt4);
     $ret = nl2br(stripslashes_b($v[1]));
     $cell = div(ats('margin:auto;'), $ret);
     $ret = $bt . div(atc('book') . ats('display:flex; min-height:300px; width:94%;'), $cell);
     return $ret;
 }
function mareaRojaColumnaDesembarcoResultados($id)
{
    $_ci =& get_instance();
    $_ci->load->helper(array("modulo/marea_roja/permiso", "modulo/marea_roja/acta", "modulo/archivo/archivo"));
    $html = "";
    $_ci->load->model("marea_roja_desembarco_model", "_marea_roja_model");
    $_ci->load->model("marea_roja_desembarco_informe_model", "_marea_roja_desembarco_informe_model");
    $marea_roja = $_ci->_marea_roja_model->getById($id);
    if (!is_null($marea_roja)) {
        $html = div("btn-group", array("width" => "135px"));
        $html .= botonSM("Ver detalle desembarco", "btn-primary ver-marea-roja-desembarco", "fa-search", array("rel" => $marea_roja->id));
        if (permisoMareaRoja("editar")) {
            $html .= botonSM("Ingresar resultados", "btn-success editar-marea-roja", "fa-plus-square-o", array("rel" => $marea_roja->id));
        }
        if (permisoMareaRoja("validar")) {
            if ($marea_roja->bo_ingreso_resultado) {
                $html .= botonSM("Validar resultado", "btn-green validar", "fa-check-circle", array("rel" => $marea_roja->id));
            }
            if ($marea_roja->bo_validado) {
                $existe = $_ci->_marea_roja_desembarco_informe_model->getByDesembarco($marea_roja->id);
                if (is_null($existe)) {
                    $html .= botonSM("Generar informe de desembarco", "btn-info generar-informe", "fa-file-o", array("rel" => $marea_roja->id));
                } else {
                    $html .= botonSM("Ver informe de desembarco", "btn-primary ver-informe", "fa-file", array("rel" => urlArchivo($existe->id_archivo)));
                }
            }
        }
        $html .= divClose();
    }
    return $html;
}
Example #5
0
 private function get_menu_item($menu_id)
 {
     $this->load->library('table');
     $this->load->model('menu_item');
     $content_vars = array();
     // Template da tabela
     $this->table->set_template(array('table_open' => '<table class="table table-striped table-bordered">'));
     $this->table->set_heading('Label', 'Ordem', 'Tipo', 'Link', 'Ações');
     $query = $this->menu_item->get_by_field('menu_id', $menu_id, array('field' => 'ordem', 'order' => 'asc'));
     foreach ($query->result() as $row) {
         switch ($row->tipo) {
             case 'post':
                 $link = $this->get_titulo_postagem($row->href);
                 break;
             case 'posts':
                 $link = $this->get_titulo_categoria($row->href);
                 break;
             case 'link':
                 $link = $row->href;
                 break;
             case 'funcional':
                 $link = humanize($row->href);
                 break;
             case 'submenu':
                 $link = $this->get_titulo_menu($row->href);
                 break;
         }
         $this->table->add_row($row->label, $row->ordem, humanize($row->tipo), $link, div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/menuitens/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/menuitens/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true));
     }
     $content_vars['menu_id'] = $menu_id;
     $content_vars['listagem'] = $this->table->generate();
     return $this->load->view('menuitens/index', $content_vars, TRUE);
 }
Example #6
0
 function __construct(Thread $thread)
 {
     parent::__construct($thread->getBoard());
     $topLinks = div('', 'topLinks navLinks')->append('[' . a('Home', '/index') . ']')->append(' [' . a('Return', '/' . $this->board->getName() . '/') . ']');
     if (!$thread->getBoard()->isSwfBoard()) {
         $topLinks->append(' [' . a('Catalog', '/' . $this->board->getName() . '/catalog') . ']');
     }
     if (!$thread->getBoard()->isArchive() && $thread->isActive()) {
         if ($thread->isClosed()) {
             $this->appendToBody(el('h2', 'Thread is closed.'));
         } else {
             if (!isset($_SESSION['captcha'])) {
                 $_SESSION['captcha'] = rand(100000, 999999);
             }
             $this->appendToBody(Site::parseHtmlFragment('postForm.html', ['_board_', '_resto_', '_password_'], [$thread->getBoard()->getName(), $thread->getThreadId(), 'password']));
         }
     }
     $this->appendToBody($topLinks);
     $thread->loadAll();
     $dur = secsToDHMS($thread->getPost($thread->getPosts() - 1)->getTime() - $thread->getPost(0)->getTime());
     $board = div('', 'board');
     if ($thread->getBoard()->isArchive()) {
         $threadStats = Site::parseHtmlFragment("threadStats.html", ["__threadid__", "__posts__", "__posts_actual__", "__images__", "__images_actual__", "__lifetime__", "__deleted__", "<!--4chanLink-->", "<!--tag-->"], [$thread->getThreadId(), $thread->getChanPosts(), $thread->getPosts() - 1, $thread->getChanImages(), $thread->getImages() - 1, "{$dur[0]}d {$dur[1]}h {$dur[2]}m {$dur[3]}s", $thread->getDeleted(), $thread->isActive() ? "<a target='_blank' href='//boards.4chan.org/{$this->board->getName()}/thread/{$thread->getThreadId()}'>View on 4chan</a>" : "Thread is dead.", $thread->getTag() != null ? "<br>Tagged as: " . $thread->getTag() : ""]);
         $board->append($threadStats);
     } else {
         $board->append('<hr>');
     }
     $this->appendToBody($board->append(div($thread->displayThread(), 'thread')));
     $bottomLinks = $topLinks;
     $this->appendToBody("<hr>" . $bottomLinks);
 }
Example #7
0
File: book.php Project: philum/cms
function book_cover($t)
{
    $t = str_replace(' ', "\n", $t);
    $w = $_SESSION['prma']['content'];
    $t = call_plug('', 'popup', 'book', ajx($_SESSION['book']) . '_' . $w, $t);
    //
    return div(' class="book" style="background-color:black; padding:10px; width:220px;"', divs('background-color:#222; border:1px solid #fff; padding:5px; margin:auto; color:white; font-size:16px; text-align:center; text-decoration:none;', $t));
    return $ret;
}
Example #8
0
 public function to_html_link(\System\Template\Renderer $ren, $short_name = true)
 {
     if ($short_name && mb_strlen($this->name_full) > 32) {
         $long_name = substr($this->name_full, 0, 32) . '...';
     } else {
         $long_name = $this->name_full;
     }
     return div('name', array($ren->link_for('team', $this->name, array("args" => array($this), "class" => 'short')), span('sep', ' - '), $ren->link_for('team', $long_name, array("args" => array($this), "class" => 'full'))));
 }
Example #9
0
File: favs.php Project: philum/cms
function fav_render_cols($r)
{
    req('spe');
    if ($r) {
        foreach ($r as $id => $v) {
            $ret .= fav_art($id);
        }
    }
    return div(atc('cols') . ats('width:640px;'), $ret);
}
Example #10
0
 public function __construct(Board $board)
 {
     parent::__construct("/{$board->getName()}/ - {$board->getLongName()}", "", $board->getPrivilege());
     $boardBanner = div("", "boardBanner centertext")->append(div("/{$board->getName()}/ - {$board->getLongName()}", "boardTitle"));
     if ($board->isArchive()) {
         $boardBanner->append(a("View this board on 4chan", '//boards.4chan.org/' . $board->getName()));
     }
     $this->appendToBody("<hr>" . $boardBanner . "<hr>");
     $this->board = $board;
 }
Example #11
0
 private function initNavbar()
 {
     $this->navbar = div('', 'navbar');
     foreach (Config::getCfg('navlinks') as $name => $link) {
         $this->navbar->append(a(span("&nbsp;{$name}&nbsp;", 'navelement'), $link));
     }
     $stylelist = el('ul');
     foreach (Config::getCfg("styles") as $name => $css) {
         $stylelist->append(el('li', a("&nbsp;{$name}&nbsp;", "javascript:")->set("onclick", "StyleSwitcher.switchTo('{$name}')")->set("class", 'navelement')->set("title", $name)));
     }
     $this->navbar->append(el('ul', el('li', '[Page Style]' . $stylelist, ['class' => 'navelement']), ['class' => 'stylemenu']));
 }
Example #12
0
function date_diff_to_text($seconds)
{
    $minutes = div($seconds, 60);
    $seconds = $seconds % 60;
    if ($minutes < 60) {
        return sprintf("%02d:%02d", $minutes, $seconds);
    } else {
        $hours = div($minutes, 60);
        $minutes = $minutes % 60;
        return sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds);
    }
}
Example #13
0
 public function index()
 {
     $this->load->library('table');
     $this->table->set_template(array('table_open' => '<table id="grid" class="table table-striped">'));
     $this->table->set_heading('Id', 'Titulo', 'Descricao', 'Status', 'Ações');
     $query = $this->video->get_list()->result();
     foreach ($query as $row) {
         $this->table->add_row($row->id, $row->titulo, $row->descricao, status_post($row->status), div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/videos/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/videos/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true));
     }
     $this->content_vars['listagem'] = $this->table->generate();
     $this->wpanel->load_view('videos/index', $this->content_vars);
 }
/**
 * 
 * @deprecated since 5.0.0
 */
function jalali_week_day($j_y, $j_m, $j_d)
{
    global $j_days_in_month;
    $jy = $j_y - 979;
    $jm = $j_m - 1;
    $jd = $j_d - 1;
    $j_day_no = 365 * $jy + div($jy, 33) * 8 + div($jy % 33 + 3, 4);
    for ($i = 0; $i < $jm; ++$i) {
        $j_day_no += $j_days_in_month[$i];
    }
    $j_day_no += $jd;
    return ($j_day_no + 2) % 7 + 1;
}
Example #15
0
function demoMod($a, $b)
{
    echo "Demo for pair ({$a}, {$b}):\n";
    $c = $a / $b;
    $ic = idiv($a, $b);
    $d = $a % $b;
    $mc = div($a, $b);
    $md = mod($a, $b);
    echo "Standard PHP division: {$a}  / {$b} = {$c}\n";
    echo "Custom integer division: {$a} / {$b} = {$ic}\n";
    echo "Fixed integer division: {$a} / {$b} = {$mc}\n";
    echo "Standard PHP integer modulo: {$a} % {$b} = {$d}\n";
    echo "Fixed integer modulo: {$a} mod {$b} = {$md}\n\n";
}
Example #16
0
File: umtoa.php Project: philum/cms
function umtoa_build()
{
    $r = ummo_toa();
    $ratio = 10;
    foreach ($r as $k => $v) {
        list($aeon, $xee, $txt, $pos, $height, $year) = $v;
        $date = 'Ere ' . $aeon . ' / Xee ' . $xee . ' (' . $year . ') ';
        //$top='top:'.($pos/$ratio+40).'px; ';
        $sty = 'height:' . $height / $ratio . 'px;';
        $css = 'hline ' . ($txt == 'Nuit Noire' ? 'aeonblack' : 'aeon' . $aeon);
        $ret .= div(atc($css) . ats($sty), $date . $txt);
    }
    return div(atc('vline') . ats('height:' . (($pos + $height) / $ratio + 40) . 'px;'), $ret);
}
Example #17
0
function overpop($t, $id, $clr, $typo, $opac, $w = 320, $h = 240)
{
    $randid = randid();
    $ov = 'document.getElementById(\'crt1' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, 0) . '\'; document.getElementById(\'crt2' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, 0.9) . '\';';
    $ot = 'document.getElementById(\'crt1' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, $opac) . '\'; document.getElementById(\'crt2' . $randid . '\').style.backgroundColor=\'' . hexrgb($clr, 1) . '\';';
    $go = is_numeric($id) ? 'href="' . urlread($id) . '"' : atb('onclick', $id);
    //title
    $title = div(' id="crt2' . $randid . '" style="font-family:' . $typo . '; font-size:24px; text-align:center; color:#' . invert_color($clr, 1) . '; padding:10px; width:140px; background-color:#' . $clr . '; margin:100px auto; vertical-align:middle; box-shadow:0 0 5px #' . $clr . '; text-shadow: 0 0 3px #' . invert_color($clr, 0) . ';"', $t);
    // transition: all 1s ease;
    //rideau
    $sty = 'position:absolute; width:' . ($w ? $w : 320) . 'px; height:' . ($h ? $h : 240) . 'px; background-color:' . hexrgb($clr, $opac) . '; text-align-center; vertical-align:middle; transition: all 1s ease; box-shadow:2px 2px 5px ' . hexrgb('000000', 0.5) . '; display:inline-block;';
    $ret = div(' style="' . $sty . '" id="crt1' . $randid . '"', $t ? $title : '');
    $ret = '<a ' . $go . atb('onmouseover', $ov) . atb('onmouseout', $ot) . '>' . $ret . '</a>';
    return $ret;
}
Example #18
0
 /**
  * Gets the news in tree and show it in table from AJAX
  * @return html
  */
 function getBrands()
 {
     $model = rad_instances::get('model_corecatalog_brands');
     $model->setState('select', 'count(*)');
     $items_count = $model->getItem();
     $model->unsetState('select');
     $page = (int) $this->request('p', 1) - 1;
     $limit = $page * $this->_itemsperpage . ',' . $this->_itemsperpage;
     $this->setVar('items', $model->getItems($limit));
     $this->setVar('total_rows', $items_count);
     $pages = div((int) $items_count, $this->_itemsperpage);
     $pages += $items_count % $this->_itemsperpage ? 1 : 0;
     $this->setVar('pages_count', $pages + 1);
     $this->setVar('page', $page + 1);
 }
Example #19
0
function msqlxread()
{
    $page = $_GET['page'] ? $_GET['page'] : 1;
    $npg = 10;
    require 'plug/microxml.php';
    $min = ($page - 1) * $npg;
    $max = $page * $npg;
    $i = 0;
    $site = 'http://philum.net';
    //$site=philum();//father_server
    $r = clkt($site . '/msql/clients/philum_tickets');
    unset($r['_menus_']);
    if ($r) {
        foreach ($r as $k => $v) {
            //array('host','hub','msg','day','ip')
            if ($v[0] == $_SERVER['HTTP_HOST'] && $v[1] == ses('qb')) {
                $del = lj('txtyl', 'tickets_plug___tickets_tickets*j_' . $k . '_x', 'x');
            } else {
                $del = '';
            }
            $answ = ljb('popbt', 'jumpMenu_text', 'tckansw_' . ($v[5] ? $v[5] : $k), nms(91));
            $rb[$k] .= btn('txtsmall2', $v[3]) . ' ';
            $rb[$k] .= lkc('txtsmall', 'http://' . $v[0] . '/' . $v[1], $v[1]) . ' ';
            if (!$v[5]) {
                $rb[$k] .= $answ . ' ';
            }
            $rb[$k] .= $del . br();
            $msg = $v[2];
            if (!function_exists('correct_txt')) {
                req('tri,pop,spe');
            }
            //$msg=correct_txt($msg,'','sconn');
            if ($i >= $min && $i < $max) {
                $msg = miniconn($msg);
            }
            $i++;
            $rb[$k] .= divc('" style="width:400px;', nl2br(stripslashes($msg))) . br();
            if ($v[5]) {
                $rb[$v[5]] .= div(ats('margin-left:40px;'), $rb[$k]);
                unset($rb[$k]);
            }
        }
    }
    if ($rb) {
        rsort($rb);
    }
    return by_pages($rb, $page);
}
Example #20
0
File: ajax.php Project: philum/cms
function popup($t, $d, $w = '', $p = '')
{
    if ($w) {
        $s = 'max-width:' . ($w + 16) . 'px;';
    }
    if ($p == 1) {
        $p = lj('', 'page_deskbkg', picto('desktop')) . ' ';
    }
    if ($p == 2) {
        $p = ljb('', 'pagrepos()', '', picto('expand')) . ' ';
    }
    $popa = popa($t, $p, $s);
    $_SESSION['popm'] = '';
    // onresize="poprepos()"
    return div(atc('popup') . ats($s) . atb('onmouseup', 'stop_drag(event)'), $popa . div(atd('popu') . atc('popu'), $d));
}
Example #21
0
 static function slide($r, $p, $rid)
 {
     $j = $rid . '_class___slides_j_';
     $v = $r[$p];
     if ($r[$p - 1]) {
         $bt1 = lj('', $j . ($p - 1) . '_' . $rid . '_inp', pictxt('left', $p - 1)) . ' ';
     }
     if ($r[$p + 1]) {
         $bt2 = lj('', $j . ($p + 1) . '_' . $rid . '_inp', pictxt('right', $p + 1)) . ' ';
     }
     $bt = divc('', $bt1 . $bt2);
     $ret = nl2br(stripslashes_b($v[0]));
     $cell = div(ats('margin:auto;'), $ret);
     $ret = $bt . div(atc('book') . ats('display:flex; min-height:300px; width:94%;'), $cell);
     return $ret;
 }
Example #22
0
 public function __construct(ImageBoard\Board $board)
 {
     parent::__construct($board);
     if ($board->isSwfBoard()) {
         //throw new Exception("Catalogs don't work on upload boards");
     }
     $this->addToHead("<link rel='stylesheet' href='/css/bstats-catalog.css' type='text/css'>");
     $catalog = OldModel::getCatalog($board, false);
     $this->appendToBody(div('', 'topLinks navLinks')->append('[' . a('Home', '/index') . ']')->append(' [' . a('Return', '/' . $board->getName() . '/') . ']') . '<br/><br/>');
     $html = div('', 'extended-small')->set('id', 'threads');
     while ($thread = $catalog->fetch_assoc()) {
         $post = new Post($thread, $board);
         $html->append(PostRenderer::renderPost($post, PostRenderer::DISPLAY_CATALOG));
     }
     $this->appendToBody($html);
 }
Example #23
0
 public function index()
 {
     $this->load->model('post');
     $this->load->library('table');
     $layout_vars = array();
     $content_vars = array();
     // Template da tabela
     $this->table->set_template(array('table_open' => '<table id="grid" class="table table-striped">'));
     $this->table->set_heading('#', 'Título', 'Data', 'Status', 'Ações');
     $query = $this->post->get_by_field('page', '1');
     foreach ($query->result() as $row) {
         $this->table->add_row($row->id, $row->title, mdate('%d/%m/%Y', strtotime($row->created)), status_post($row->status), div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/pages/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/pages/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true));
     }
     $content_vars['listagem'] = $this->table->generate();
     $this->wpanel->load_view('pages/index', $content_vars);
 }
Example #24
0
 public function index()
 {
     $this->load->model('categoria');
     $this->load->library('table');
     $layout_vars = array();
     $content_vars = array();
     // Template da tabela
     $this->table->set_template(array('table_open' => '<table id="grid" class="table table-striped">'));
     $this->table->set_heading('#', 'Título', 'Categoria-pai', 'Visão', 'Ações');
     $query = $this->categoria->get_list();
     foreach ($query->result() as $row) {
         $this->table->add_row($row->id, $row->title, $this->categoria->get_title_by_id($row->category_id), $row->view, div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/categorias/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/categorias/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true));
     }
     $content_vars['listagem'] = $this->table->generate();
     $this->wpanel->load_view('categorias/index', $content_vars);
 }
Example #25
0
function admin_free()
{
    global $privileges;
    $search = "";
    if (isset($_REQUEST['search'])) {
        $search = strip_request_item('search');
    }
    $angeltypesearch = "";
    if (empty($_REQUEST['angeltype'])) {
        $_REQUEST['angeltype'] = '';
    } else {
        $angeltypesearch = " INNER JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id` = '" . sql_escape($_REQUEST['angeltype']) . "' AND `UserAngelTypes`.`user_id` = `User`.`UID`";
        if (isset($_REQUEST['confirmed_only'])) {
            $angeltypesearch .= " AND `UserAngelTypes`.`confirm_user_id`";
        }
        $angeltypesearch .= ") ";
    }
    $angel_types_source = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`");
    $angel_types = array('' => 'alle Typen');
    foreach ($angel_types_source as $angel_type) {
        $angel_types[$angel_type['id']] = $angel_type['name'];
    }
    $users = sql_select("\n      SELECT `User`.* \n      FROM `User` \n      {$angeltypesearch} \n      LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` \n      LEFT JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID` AND `Shifts`.`start` < '" . sql_escape(time()) . "' AND `Shifts`.`end` > '" . sql_escape(time()) . "') \n      WHERE `User`.`Gekommen` = 1 AND `Shifts`.`SID` IS NULL \n      GROUP BY `User`.`UID` \n      ORDER BY `Nick`");
    $free_users_table = array();
    if ($search == "") {
        $tokens = array();
    } else {
        $tokens = explode(" ", $search);
    }
    foreach ($users as $usr) {
        if (count($tokens) > 0) {
            $match = false;
            $index = join("", $usr);
            foreach ($tokens as $t) {
                if (stristr($index, trim($t))) {
                    $match = true;
                    break;
                }
            }
            if (!$match) {
                continue;
            }
        }
        $free_users_table[] = array('name' => User_Nick_render($usr), 'shift_state' => User_shift_state_render($usr), 'handy' => $usr['Handy'], 'telefon' => $usr['Telefon'], 'email' => $usr['email'], 'kommentar' => $usr['kommentar'], 'actions' => in_array('admin_user', $privileges) ? button(page_link_to('admin_user') . '&amp;id=' . $usr['UID'], _("edit"), 'btn-xs') : '');
    }
    return page_with_title(admin_free_title(), array(form(array(div('row', array(div('col-md-4', array(form_text('search', _("Search"), $search))), div('col-md-4', array(form_select('angeltype', _("Angeltype"), $angel_types, $_REQUEST['angeltype']))), div('col-md-2', array(form_checkbox('confirmed_only', _("Only confirmed"), isset($_REQUEST['confirmed_only'])))), div('col-md-2', array(form_submit('submit', _("Search")))))))), table(array('name' => _("Nick"), 'shift_state' => '', 'handy' => _("Mobile"), 'telefon' => _("Phone"), 'email' => _("E-Mail"), 'kommentar' => _("add. Info"), 'actions' => ''), $free_users_table)));
}
Example #26
0
 public function index()
 {
     $this->load->model('album');
     $this->load->library('table');
     $layout_vars = array();
     $content_vars = array();
     // Template da tabela
     $this->table->set_template(array('table_open' => '<table id="grid" class="table table-striped">'));
     $this->table->set_heading('#', 'Capa', 'Título', 'Data', 'Status', 'Ações');
     $query = $this->album->get_list();
     foreach ($query->result() as $row) {
         $capa_properties = array('src' => base_url() . '/media/capas/' . $row->capa, 'class' => 'img-responsive', 'width' => '120', 'alt' => $row->titulo);
         $capa = img($capa_properties);
         $this->table->add_row($row->id, $capa, anchor('admin/fotos/index/' . $row->id, glyphicon('picture') . $row->titulo), mdate('%d/%m/%Y - %H:%i', strtotime($row->created)), status_post($row->status), div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/fotos/index/' . $row->id, glyphicon('picture'), array('class' => 'btn btn-default')) . anchor('admin/albuns/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/albuns/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true));
     }
     $content_vars['listagem'] = $this->table->generate();
     $this->wpanel->load_view('albuns/index', $content_vars);
 }
Example #27
0
function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up)
{
    $parsedown = new Parsedown();
    $angeltypes = [];
    foreach ($angeltypes_source as $angeltype) {
        $angeltypes[$angeltype['id']] = $angeltype;
    }
    $needed_angels = '';
    foreach ($shift['NeedAngels'] as $needed_angeltype) {
        $class = 'progress-bar-warning';
        if ($needed_angeltype['taken'] == 0) {
            $class = 'progress-bar-danger';
        }
        if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
            $class = 'progress-bar-success';
        }
        $needed_angels .= '<div class="list-group-item">';
        $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '</div>';
        $needed_angels .= '<h3>' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '</h3>';
        $needed_angels .= progress_bar(0, $needed_angeltype['count'], min($needed_angeltype['taken'], $needed_angeltype['count']), $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
        $angels = [];
        foreach ($shift['ShiftEntry'] as $shift_entry) {
            if ($shift_entry['TID'] == $needed_angeltype['TID']) {
                $entry = User_Nick_render(User($shift_entry['UID']));
                if ($shift_entry['freeloaded']) {
                    $entry = '<strike>' . $entry . '</strike>';
                }
                if ($user_shift_admin) {
                    $entry .= ' <div class="btn-group">';
                    $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
                    $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
                    $entry .= '</div>';
                }
                $angels[] = $entry;
            }
        }
        $needed_angels .= join(', ', $angels);
        $needed_angels .= '</div>';
    }
    $shiftManagers = getShiftManagers($shift['SID']);
    return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [msg(), Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '', $signed_up ? info(_('You are signed up for this shift.'), true) : '', $shift_admin || $admin_shifttypes || $admin_rooms ? buttons([$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '']) : '', div('row', [div('col-sm-3 col-xs-6', ['<h4>' . _('Title') . '</h4>', '<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Start') . '</h4>', '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['start']), '<br />', glyph('time') . date('H:i', $shift['start']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('End') . '</h4>', '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['end']), '<br />', glyph('time') . date('H:i', $shift['end']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Location') . '</h4>', '<p class="lead">' . glyph('map-marker') . $room['Name'] . '</p>'])]), div('row', [div('col-sm-6', ['<h2>' . _('Needed angels') . '</h2>', '<div class="list-group">' . $needed_angels . '</div>']), div('col-sm-6', [!empty($shiftManagers) ? '<h2>' . _('Shift Manager') . '</h2>' : '', !empty($shiftManagers) ? implode('<br>', array_map(function ($manager) {
        return $manager['Vorname'] . ' ' . $manager['Name'];
    }, $shiftManagers)) : '', '<h2>' . _('Description') . '</h2>', $parsedown->parse($shifttype['description'])])]), $shift_admin ? Shift_editor_info_render($shift) : '']);
}
/**
 * Edit a user's driving license information.
 * @param User $user_source
 * @param bool $wants_to_drive
 * @param bool $has_car
 * @param bool $has_license_car
 * @param bool $has_license_3_5t_transporter
 * @param bool $has_license_7_5t_truck
 * @param bool $has_license_12_5t_truck
 * @param bool $has_license_forklift
 */
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift)
{
    return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [buttons([button(user_link($user_source), _("Back to profile"), 'back')]), msg(), form([form_info(_("Privacy"), _("Your driving license information is only visible for coordinators and admins.")), form_checkbox('wants_to_drive', _("I am willing to operate cars for the PL"), $wants_to_drive), div('panel panel-default', [div('panel-body', [form_checkbox('has_car', _("I have my own car with me and am willing to use it for the PL (You'll get reimbursed for fuel)"), $has_car), heading(_("Driver license"), 3), form_checkbox('has_license_car', _("Car"), $has_license_car), form_checkbox('has_license_3_5t_transporter', _("Transporter 3,5t"), $has_license_3_5t_transporter), form_checkbox('has_license_7_5t_truck', _("Truck 7,5t"), $has_license_7_5t_truck), form_checkbox('has_license_12_5t_truck', _("Truck 12,5t"), $has_license_12_5t_truck), form_checkbox('has_license_forklift', _("Forklift"), $has_license_forklift)])], 'driving_license'), form_submit('submit', _("Save"))]), '<script type="text/javascript">
        $(function() {
          if($("#wants_to_drive").is(":checked"))
            $("#driving_license").show();
          else
            $("#driving_license").hide();
        
          $("#wants_to_drive").click(
            function(e) {
              if($("#wants_to_drive").is(":checked"))
                $("#driving_license").show();
              else
                $("#driving_license").hide();
            }
          );
        });
      </script>']);
}
Example #29
0
/**
 * Returns information about pagination.
 *
 * @param int $items_count Count of items which are separated by pages.
 * @param int $default_items_per_page Count of items per page.
 * @return array|boolean Associative array of pagination info or FALSE if the
 * info array cannot be build. Info array contatins the following keys:
 *   - page: int, number of current page.
 *   - total: int, total pages count.
 *   - items: int, items per page.
 *   - count: int, total items count.
 *   - start: int, index of item to start from.
 *   - end: int, index of item to end at.
 */
function pagination_info($items_count, $default_items_per_page = 15)
{
    if ($items_count) {
        $items_per_page = verify_param("items", "/^\\d{1,3}\$/", $default_items_per_page);
        if ($items_per_page < 2) {
            $items_per_page = 2;
        }
        $total_pages = div($items_count + $items_per_page - 1, $items_per_page);
        $curr_page = verify_param("page", "/^\\d{1,6}\$/", 1);
        if ($curr_page < 1) {
            $curr_page = 1;
        }
        if ($curr_page > $total_pages) {
            $curr_page = $total_pages;
        }
        $start_index = ($curr_page - 1) * $items_per_page;
        $end_index = min($start_index + $items_per_page, $items_count);
        return array("page" => $curr_page, "items" => $items_per_page, "total" => $total_pages, "count" => $items_count, "start" => $start_index, "end" => $end_index);
    } else {
        return false;
    }
}
Example #30
0
 public function index($album_id)
 {
     $this->load->model('album');
     $this->load->model('foto');
     $this->load->library('table');
     $layout_vars = array();
     $content_vars = array();
     // Dados do álbum
     // $query_album = $this->album->get_by_id($album_id)->row();
     // Template da tabela
     $this->table->set_template(array('table_open' => '<table id="grid" class="table table-striped">'));
     $this->table->set_heading('#', 'Imagem', 'Descricao', 'Data', 'Status', 'Ações');
     $query = $this->foto->get_by_field('album_id', $album_id, array('field' => 'created', 'order' => 'desc'));
     foreach ($query->result() as $row) {
         $capa_properties = array('src' => base_url() . '/media/albuns/' . $album_id . '/' . $row->filename, 'class' => 'img-responsive', 'width' => '120', 'alt' => $row->descricao);
         $imagem = img($capa_properties);
         $this->table->add_row($row->id, $imagem, $row->descricao, mdate('%d/%m/%Y - %H:%i', strtotime($row->created)), status_post($row->status), div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/fotos/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/fotos/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true));
     }
     $content_vars['album_id'] = $album_id;
     $content_vars['listagem'] = $this->table->generate();
     $this->wpanel->load_view('fotos/index', $content_vars);
 }