function overview() { $this->pics_scaff->add_search_field('Name'); $this->pics_scaff->add_search_field('Jahr'); $this->pics_scaff->template_vars['Name_value'] = $_GET['Name'] ? $_GET['Name'] : ''; if ($name = $_GET['Name']) { $_GET['Name'] = "%{$name}%"; } $this->pics_scaff->template_vars['Jahr_value'] = $_GET['Jahr'] ? $_GET['Jahr'] : ''; if ($jahr = $_GET['Jahr']) { $_GET['Jahr'] = "%{$jahr}%"; } $where = array(); foreach ($this->pics_scaff->enable_search_for as $spalte) { if ($_GET[$spalte]) { $value = General::input_clean($_GET[$spalte], true); $where[] = "`{$spalte}` LIKE '{$value}'"; } } $where = $where ? "WHERE " . implode($this->pics_scaff->search_combinate, $where) : ''; $images_sql = $all_images_sql = "SELECT * FROM `{$this->pics_db_table}` {$where}"; $order = $_GET['order'] ? "&order=" . $_GET['order'] : ''; if ($_GET['dir'] == 'desc') { $auf = 'Aufsteigend'; $ab = Html::bold(Html::italic('Absteigend')); $dir = 'DESC'; $desc = '&dir=asc'; } else { if ($_GET['dir'] == 'asc') { $auf = Html::bold(Html::italic('Aufsteigend')); $ab = 'Absteigend'; $dir = 'ASC'; $desc = '&dir=desc'; } else { $dir = 'ASC'; $desc = '&dir=desc'; } } $return .= ' '; $this->pics_scaff->edit_enabled = true; foreach ($this->pics_scaff->cols_array as $col) { $name = $_GET['order'] == $col['name'] ? Html::bold(Html::italic($col['name'])) : $col['name']; $desc = $_GET['order'] == $col['name'] ? $_GET['dir'] == 'desc' ? '&dir=asc' : '&dir=desc' : '&dir=desc'; $this->pics_scaff->template_vars[$col['name'] . '_button'] = Html::a('/Admin/RheinaufExhibitionAdmin/Pictures?order=' . rawurlencode($col['name']) . $desc, $name); } $this->pics_scaff->results_per_page = 30; $pages = $this->pics_scaff->get_pages($all_images_sql); $pagination = $this->pics_scaff->num_rows . " Bilder auf {$pages} Seiten "; $prev_link = ($prev = $this->pics_scaff->prev_link()) ? Html::a(SELF . '?order=' . $_GET['order'] . '&dir=' . $_GET['dir'] . '&' . $prev, '<<<', array('class' => 'button')) : ''; $next_link = ($next = $this->pics_scaff->next_link()) ? Html::a(SELF . '?order=' . $_GET['order'] . '&dir=' . $_GET['dir'] . '&' . $next, '>>>', array('class' => 'button')) : ''; $this->pics_scaff->template_vars['pagination'] = $pagination . $prev_link . "Seite " . $this->pics_scaff->get_page() . ' von ' . $pages . ' ' . $next_link; $order = $_GET['order'] ? rawurldecode($_GET['order']) : 'Name'; return Html::h(2, 'Alle Bilder') . $this->pics_scaff->make_table("{$images_sql} ORDER BY {$order} {$dir}", INSTALL_PATH . '/Module/RheinaufExhibition/Backend/Templates/ExhibitionPicturesOverview.template.html'); }
/** * Tests Html::h() * * @test */ public function test_h() { $output = Html::h('Example'); $expected = "<h1>Example</h1>"; $this->assertEquals($expected, $output); $output = Html::h('Some other example', '2', array('id' => 'h2', 'class' => 'sample', 'style' => 'color:red;')); $expected = '<h2 id="h2" class="sample" style="color:red;">Some other example</h2>'; $this->assertEquals($expected, $output); $attributes = array('id' => 'sample', 'class' => 'sample', 'style' => 'color:blue;'); $output = Html::h('Variable!', '3', $attributes); $expected = '<h3 id="sample" class="sample" style="color:blue;">Variable!</h3>'; $this->assertEquals($expected, $output); }
function show() { $year = date("Y"); $month = date("n"); $monate = Date::monate(); $monat = $monate[$month]; $sql = "SELECT * FROM `{$this->db_table}` WHERE `BDM_Monat`='{$month}' AND `BDM_Jahr`='{$year}'"; $result = $this->connection->db_single_row($sql); extract($result); $img = Html::img('/Images/Galerie/' . $Dateiname, $Name, array('width' => 450, 'class' => 'rahmen', 'title' => $Name . ' - klicken für mehr Informationen')); $link = Html::a('/Bilder?Detailid=' . $id, $img); $return = $link . Html::h(2, "Bild des Monats {$monat} {$year}", array('style' => 'font-size:18px;text-indent:3px;')); $return .= Html::p("\"{$Name}\"", array('style' => 'color:white;font-size:18px;margin-top:15px;text-indent:3px;')); $return .= Html::p("{$Technik}, {$Jahr}", array('style' => 'text-indent:3px;')); return $return; }
function show() { if (!$this->check_right('ExhibitionAdmin')) { return Html::h(2, 'Dazu haben Sie kein Recht!'); } $this->system->backend->tabs = $this->obere_navi(); if ($this->check_folder_rights()) { return $this->check_folder_rights(); } if (preg_match('/Scan$/', SELF)) { $this->return .= $this->scan(); } if (preg_match('/Upload$/', SELF)) { $this->return .= $this->upload(); } if (preg_match('/Rooms$/', SELF)) { include_once INSTALL_PATH . '/Module/RheinaufExhibition/Backend/rooms.php'; $rooms = new rooms($this->scaff, $this->system); $this->return .= $GLOBALS['backchannel']; $this->return .= $rooms->show(); } if (preg_match('/Exhibitions$/', SELF)) { include_once INSTALL_PATH . '/Module/RheinaufExhibition/Backend/exhibitions.php'; $instance = new exhibitions($this->scaff, $this->system); $this->return .= $GLOBALS['backchannel']; $this->return .= $instance->show(); } if (preg_match('/Pictures$/', SELF)) { include_once INSTALL_PATH . '/Module/RheinaufExhibition/Backend/pictures.php'; $instance = new pictures($this->scaff, $this->system); return $this->return .= $instance->show(); } if (preg_match('/Locations$/', SELF)) { include_once INSTALL_PATH . '/Module/RheinaufExhibition/Backend/LocationsBackend.php'; $instance = new LocationsBackend($this->system); return $this->return .= $instance->show(); } if (preg_match('/BildDesMonats$/', SELF)) { include_once INSTALL_PATH . '/Module/RheinaufExhibition/Backend/bdm.php'; $instance = new bdm($this->scaff, $this->system); return $this->return .= $instance->show(); } return $this->return; }
function edit_loc() { $loc_id = $_GET['editloc']; $js = $this->get_lat_long_js(); $this->scaff->cols_array['js']['type'] = 'custom'; $this->scaff->cols_array['js']['custom_input'] = Html::script($js); $this->scaff->cols_array['Location_id']['type'] = 'hidden'; $this->scaff->cols_array['Location_name']['name'] = 'Name'; $this->scaff->cols_array['Jahr']['type'] = 'ignore'; $this->scaff->cols_array['Werk']['type'] = 'ignore'; $this->scaff->cols_array['Beschreibung']['type'] = 'ignore'; $this->scaff->cols_array['Technik']['type'] = 'ignore'; $this->scaff->cols_array['Mitarbeit']['type'] = 'ignore'; $this->scaff->cols_array['Ausführung']['type'] = 'ignore'; $this->scaff->cols_array['Architekten']['type'] = 'ignore'; $this->scaff->cols_array['Literatur']['type'] = 'ignore'; $this->scaff->cols_array['Bilder']['type'] = 'ignore'; $this->scaff->cols_array['getcoords']['type'] = 'custom'; $this->scaff->cols_array['getcoords']['custom_input'] = Html::a("javascript:getLatLong();", 'Koordinaten abfragen'); $this->scaff->cols_array['Location_edit']['type'] = 'hidden'; $this->scaff->cols_array['Location_edit']['value'] = 'edit'; return Html::h(2, 'Ort bearbeiten') . $this->scaff->make_form($loc_id); }
function title() { $this->return .= Html::h(2, $title); }
function module_table() { $this->installed = $this->connection->db_assoc("SELECT * FROM `RheinaufCMS>Module` WHERE `SYSTEM` = 0 ORDER BY `id` ASC"); $this->available_modules = RheinaufFile::dir_array(INSTALL_PATH . '/Module', false, 'php'); foreach ($this->available_modules as $module) { $class_name = preg_replace('/\\.php/', '', $module); if ($module != 'Navi.php') { if (RheinaufFile::is_file(INSTALL_PATH . '/Module/' . $class_name . '/Install.php')) { include_once INSTALL_PATH . '/Module/' . $class_name . '/Install.php'; $class_name .= 'Install'; } else { include_once $module; } } if (is_callable(array($class_name, 'about'))) { eval('$module_about = ' . $class_name . '::about();'); switch ($module_about['type']) { case 'inPage': $this->inPageModules[] = $module_about; break; case 'installable': $this->installableModules[] = $module_about; break; } } } $return_string = ''; $this->return .= Html::h(3, 'Installierbare Module'); $table = new Table(2); $table->add_th(array('Installierbare Module', 'Installierte Module')); $form = new Form(); $form->form_tag(SELF_URL); $installed_modules = array(); foreach ($this->installed as $installed) { $installed_modules[] = $installed['Name']; } $installables_select = new Select('installable', array('size' => '10', 'style' => 'width:150px')); foreach ($this->installableModules as $modul) { if (!in_array($modul['Name'], $installed_modules)) { $installables_select->add_option(rawurlencode($modul['Name']), $modul['Name']); } } $installed_select = new Select('installed', array('size' => '10', 'style' => 'width:150px')); foreach ($installed_modules as $modul) { $installed_select->add_option(rawurlencode($modul), $modul); } $table->add_td(array($installables_select->flush_select(), $installed_select->flush_select())); $install_submit = Form::add_input('submit', 'install', 'Installieren'); $uninstall_submit = Form::add_input('submit', 'uninstall', 'Deinstallieren'); $table->add_td(array($install_submit, $uninstall_submit), array('style' => 'text-align:center')); $form->add_custom($table->flush_table()); $this->return .= $form->flush_form(); $this->return .= Html::h(3, 'Aufruf über Template'); $table = new Table(2, array('style' => 'width:500px')); $table->add_th(array('Modul', 'Einbindung')); foreach ($this->inPageModules as $module) { $table->add_td(array(Html::bold($module['Name']), $module['Usage'])); } $this->return .= $table->flush_table(); }
function overview() { $this->pics_scaff->add_search_field('Name'); $this->pics_scaff->add_search_field('Jahr'); $this->pics_scaff->template_vars['Name_value'] = $_GET['Name'] ? $_GET['Name'] : ''; if ($name = $_GET['Name']) { $_GET['Name'] = "%{$name}%"; } $this->pics_scaff->template_vars['Jahr_value'] = $_GET['Jahr'] ? $_GET['Jahr'] : ''; if ($jahr = $_GET['Jahr']) { $_GET['Jahr'] = "%{$jahr}%"; } $where = array(); foreach ($this->pics_scaff->enable_search_for as $spalte) { if ($_GET[$spalte]) { $value = General::input_clean($_GET[$spalte], true); $where[] = "`{$spalte}` LIKE '{$value}'"; } } $where = $where ? "WHERE " . implode($this->pics_scaff->search_combinate, $where) : ''; $images_sql = $all_images_sql = "SELECT * FROM `{$this->pics_db_table}` {$where}"; $order = $_GET['order'] ? "&order=" . $_GET['order'] : ''; if ($_GET['dir'] == 'desc') { $auf = 'Aufsteigend'; $ab = Html::bold(Html::italic('Absteigend')); $dir = 'DESC'; $desc = '&dir=asc'; } else { if ($_GET['dir'] == 'asc') { $auf = Html::bold(Html::italic('Aufsteigend')); $ab = 'Absteigend'; $dir = 'ASC'; $desc = '&dir=desc'; } else { $dir = 'ASC'; $desc = '&dir=desc'; } } $return .= ' '; $this->pics_scaff->edit_enabled = true; foreach ($this->pics_scaff->cols_array as $col) { $name = $_GET['order'] == $col['name'] ? Html::bold(Html::italic($col['name'])) : $col['name']; $desc = $_GET['order'] == $col['name'] ? $_GET['dir'] == 'desc' ? '&dir=asc' : '&dir=desc' : '&dir=desc'; $this->pics_scaff->template_vars[$col['name'] . '_button'] = Html::a('/Admin/RheinaufExhibitionAdmin/Pictures?order=' . rawurlencode($col['name']) . $desc, $name); } $this->pics_scaff->results_per_page = 30; $pages = $this->pics_scaff->get_pages($all_images_sql); $pagination = $this->pics_scaff->num_rows . " Bilder auf {$pages} Seiten "; $prev_link = ($prev = $this->pics_scaff->prev_link()) ? Html::a(SELF . '?order=' . $_GET['order'] . '&dir=' . $_GET['dir'] . '&' . $prev, htmlspecialchars('<<<'), array('class' => 'button')) : ''; $next_link = ($next = $this->pics_scaff->next_link()) ? Html::a(SELF . '?order=' . $_GET['order'] . '&dir=' . $_GET['dir'] . '&' . $next, htmlspecialchars('>>>'), array('class' => 'button')) : ''; $this->pics_scaff->template_vars['pagination'] = $pagination . $prev_link . "Seite " . $this->pics_scaff->get_page() . ' von ' . $pages . ' ' . $next_link; $order = $_GET['order'] ? rawurldecode($_GET['order']) : 'Name'; //Bild des Monats $sql = "SELECT * FROM `{$this->db_table}` WHERE `BildDesMonats` != '' ORDER BY `BildDesMonats` DESC"; //BDM_Monat`='$month' AND `BDM_Jahr`='$year'"; $result = $this->connection->db_single_row($sql); $last_bdm = $result['BildDesMonats']; $this->pics_scaff->template_vars['next_bdm'] = $next_bdm = substr(Date::add($last_bdm . '01', 'month', 1), 0, 6); $this->pics_scaff->template_vars['next_bdm_str'] = substr($next_bdm, 4, 2) . '/' . substr($next_bdm, 0, 4); $this->pics_scaff->cols_array['BildDesMonats']['transform'] = '($value) ? substr($value,4,2). "/" .substr($value,0,4):"";'; $this->pics_scaff->cols_array['Beschreibung']['transform'] = '($value) ? "ja":"nein";'; $this->pics_scaff->cols_array['Höhe']['transform'] = '($value) ? $value :"n.a.";'; $this->pics_scaff->cols_array['Breite']['transform'] = '($value) ? $value :"n.a.";'; $this->pics_scaff->cols_array['Name']['transform'] = 'General::wrap_string($value,20);'; $sql = "{$images_sql} ORDER BY {$order} {$dir}"; return Html::h(2, 'Alle Bilder') . $this->pics_scaff->make_table($sql, INSTALL_PATH . '/Module/RheinaufExhibition/Backend/Templates/ExhibitionPicturesOverview.template.html'); }
function order_images() { $images_sql = "SELECT bilder.*, indices.Bild_id,indices.Raum_id,indices.index\n\t\tFROM `{$this->pics_db_table}` `bilder`\n\t\tLEFT JOIN `{$this->indices_db_table}` `indices`\n\t\t ON bilder.id = indices.Bild_id\n\t\tWHERE indices.Raum_id = " . $_GET['order'] . "\n\t\tORDER BY indices.index, indices.id ASC, bilder.Name ASC"; $images = $this->connection->db_assoc($images_sql); $room_info = $this->get_room_info($_GET['order']); $return = Html::h(2, $room_info['Roomname'] . ': Reihenfolge bearbeiten'); $return .= Form::form_tag(SELF . '?order=' . $_GET['order'], '', '', array('onsubmit' => 'updateOrder()', 'id' => 'orderform', 'style' => 'float:left;margin-right:20px;')); $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Module/RheinaufExhibition/Backend/order.js')); $select = new Select('select[]', array('size' => 24, 'id' => 'select', 'onclick' => "preview(this)", 'style' => 'min-width:220px;')); foreach ($images as $img) { $dateiname = $img['Dateiname']; $select->add_option($img['id'], $dateiname . ' ' . $img['Name'], array('filename' => $dateiname)); } $return .= $select->flush_select() . Html::br(); $return .= Html::a('javascript:void(0);', 'Hoch', array('class' => 'button', 'onclick' => 'up()')); $return .= Html::a('javascript:void(0);', 'Runter', array('class' => 'button', 'onclick' => 'down()')); $return .= Html::a('javascript:void(0);', 'Löschen', array('class' => 'button', 'onclick' => 'del()')); $return .= Html::a('javascript:void(0);', 'Titelbild', array('class' => 'button', 'onclick' => 'coverpic()')); if (!$room_info['Titelbild']) { $room_info['Titelbild'] = $images[0]['Dateiname']; } $return .= Form::add_input('hidden', 'coverpic', $room_info['Titelbild'], array('id' => 'coverpic')); $return .= Form::add_input('submit', 'submit', 'Speichern', array('class' => 'button')); $return .= Html::a(SELF, 'Zurück', array('class' => 'button', 'onclick' => 'return getChanged()')); $return .= Form::close_form(); $return .= Html::div('Ausgewähltes Bild' . Html::br() . Html::img('', '', array('id' => 'selected_preview')), array('style' => 'display:none')); $return .= Html::br(); $return .= 'Titelbild' . Html::br(); $return .= Html::img('/' . $this->filepath . $this->landscape_thumb_dir . $room_info['Titelbild'], 'Noch nicht festgelegt', array('id' => 'coverpic_preview')); return $return; }
function order_rooms() { $rooms_sql = "SELECT rooms.*, indices.Exhibition_id,indices.Exhibition_id,indices.index\n\t\tFROM `{$this->rooms_db_table}` `rooms`\n\t\tLEFT JOIN `{$this->indices_db_table}` `indices`\n\t\t ON rooms.RoomId = indices.Raum_id\n\t\tWHERE indices.Exhibition_id = " . $_GET['order'] . "\n\t\tORDER BY indices.index ASC, indices.id ASC"; $rooms = $this->connection->db_assoc($rooms_sql); $script = $this->order_script(); $return = Html::h(2, $this->get_exhibition_name('order') . ': Reihenfolge bearbeiten'); $return .= Form::form_tag(SELF . '?order=' . $_GET['order'], '', '', array('onsubmit' => 'updateOrder()', 'id' => 'orderform')); $GLOBALS['scripts'] .= Html::script($script); $select = new Select('select[]', array('size' => 24, 'id' => 'select')); foreach ($rooms as $room) { $select->add_option($room['RoomId'], $room['Roomname']); } $return .= $select->flush_select() . Html::br(); $return .= Html::a('javascript:up();', 'Hoch', array('class' => 'button')); $return .= Html::a('javascript:down();', 'Runter', array('class' => 'button')); $return .= Html::a('javascript:del();', 'Löschen', array('class' => 'button')); $return .= Form::add_input('submit', 'submit', 'Speichern', array('class' => 'button')); $return .= Html::a(SELF, 'Zurück', array('class' => 'button', 'onclick' => 'return getChanged()')); $return .= Form::close_form(); return $return; }
function edit_loc() { $loc_id = $_GET['editloc']; $this->scaff->cols_array['Location_id']['type'] = 'hidden'; $this->scaff->cols_array['Location_name']['name'] = 'Name'; $this->scaff->cols_array['Jahr']['type'] = 'ignore'; $this->scaff->cols_array['Werk']['type'] = 'ignore'; $this->scaff->cols_array['Beschreibung']['type'] = 'ignore'; $this->scaff->cols_array['Technik']['type'] = 'ignore'; $this->scaff->cols_array['Mitarbeit']['type'] = 'ignore'; $this->scaff->cols_array['Ausführung']['type'] = 'ignore'; $this->scaff->cols_array['Architekten']['type'] = 'ignore'; $this->scaff->cols_array['Literatur']['type'] = 'ignore'; $this->scaff->cols_array['Bilder']['type'] = 'ignore'; $this->scaff->cols_array['Location_edit']['type'] = 'hidden'; $this->scaff->cols_array['Location_edit']['value'] = 'edit'; return Html::h(2, 'Ort bearbeiten') . $this->scaff->make_form($loc_id); }
function order_images() { $images_sql = "SELECT bilder.*, indices.Bild_id,indices.Raum_id,indices.index\r\n\t\tFROM `{$this->pics_db_table}` `bilder`\r\n\t\tLEFT JOIN `{$this->indices_db_table}` `indices`\r\n\t\t ON bilder.id = indices.Bild_id\r\n\t\tWHERE indices.Raum_id = " . $_GET['order'] . "\r\n\t\tORDER BY indices.index,bilder.Name ASC"; $images = $this->connection->db_assoc($images_sql); $script = $this->order_script(); $room_info = $this->get_room_info($_GET['order']); $return = Html::h(2, $room_info['Roomname'] . ': Reihenfolge bearbeiten'); $return .= Form::form_tag(SELF . '?order=' . $_GET['order'], '', '', array('onsubmit' => 'updateOrder()', 'id' => 'orderform', 'style' => 'float:left;margin-right:20px;')); $GLOBALS['scripts'] .= Html::script($script); $select = new Select('select[]', array('size' => 24, 'id' => 'select')); foreach ($images as $img) { $select->add_option($img['id'], $img['Dateiname']); } $return .= $select->flush_select() . Html::br(); $return .= Html::a('javascript:up();', 'Hoch', array('class' => 'button')); $return .= Html::a('javascript:down();', 'Runter', array('class' => 'button')); $return .= Html::a('javascript:del();', 'Löschen', array('class' => 'button')); $return .= Html::a('javascript:coverpic();', 'Titelbild', array('class' => 'button')); if (!$room_info['Titelbild']) { $room_info['Titelbild'] = $images[0]['Dateiname']; } $return .= Form::add_input('hidden', 'coverpic', $room_info['Titelbild'], array('id' => 'coverpic')); $return .= Form::add_input('submit', 'submit', 'Speichern', array('class' => 'button')); $return .= Html::a(SELF, 'Zurück', array('class' => 'button', 'onclick' => 'return getChanged()')); $return .= Form::close_form(); $return .= 'Titelbild' . Html::br(); $return .= Html::img('/Images/Galerie/180/' . $room_info['Titelbild'], 'Noch nicht festgelegt', array('id' => 'coverpic_preview')); return $return; }