function viewtaskgrouptypes_ALL(Web $w) { $w->Task->navigation($w, "Manage Task Groups"); History::add("Manage Task Groups"); $task_groups = $w->Task->getTaskGroups(); if ($task_groups) { usort($task_groups, array("TaskService", "sortbyGroup")); } // prepare column headings for display $line = array(array("Title", "Type", "Description", "Default Assignee")); // if task group exists, display title, group type, description, default assignee and button for specific task group info if ($task_groups) { foreach ($task_groups as $group) { $line[] = array(Html::a(WEBROOT . "/task-group/viewmembergroup/" . $group->id, $group->title), $group->getTypeTitle(), $group->description, $group->getDefaultAssigneeName()); } } else { // if no groups for this group type, say as much $line[] = array("There are no Task Groups Configured. Please create a New Task Group.", "", "", "", ""); } // display list of task groups in the target task group type $w->ctx("dashboard", Html::table($line, null, "tablesorter", true)); // tab: new task group // get generic task group permissions $arrassign = $w->Task->getTaskGroupPermissions(); // unset 'ALL' given all can never assign a task unset($arrassign[0]); // set Is Task Active dropdown $is_active = array(array("Yes", "1"), array("No", "0")); $grouptypes = $w->Task->getAllTaskGroupTypes(); // build form to create a new task group within the target group type $f = Html::form(array(array("Task Group Attributes", "section"), array("Task Group Type", "select", "task_group_type", null, $grouptypes), array("Title", "text", "title"), array("Who Can Assign", "select", "can_assign", null, $arrassign), array("Who Can View", "select", "can_view", null, $w->Task->getTaskGroupPermissions()), array("Who Can Create", "select", "can_create", null, $w->Task->getTaskGroupPermissions()), array("Active", "select", "is_active", null, $is_active), array("", "hidden", "is_deleted", "0"), array("Description", "textarea", "description", null, "26", "6"), array("Default Assignee", "select", "default_assignee_id", null, $w->Auth->getUsers())), $w->localUrl("/task-group/createtaskgroup"), "POST", "Save"); // display form $w->ctx("creategroup", $f); }
function group_table() { $group_table = ''; $this->images['edit'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit.png', 'Eigenschaften bearbeiten', array('title' => 'Eigenschaften bearbeiten')); $this->images['apply'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/apply.png', 'Speichern'); $this->images['apply_path'] = '/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/apply.png'; $this->images['checkbox_disabled_unchecked'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/checkbox_disabled_unchecked.png', 'Nicht erlaubt'); $this->images['checkbox_disabled_checked'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/checkbox_disabled_checked.png', 'Erlaubt'); $this->images['new_group'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/add_group.png', 'Gruppe hinzufügen', array('title' => 'Gruppe hinzufügen')); $this->images['delete_group'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/delete_group.png', 'Gruppe löschen', array('title' => 'Gruppe löschen')); $img_group = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit_group.png', 'Gruppe'); $cols = count($this->rechte) + 3; $table = new Table($cols, array('id' => 'groups_table')); $form_tag = Form::form_tag('/Admin/Gruppen'); $form_close = Form::close_form(); $th = array(Html::bold('Gruppe')); foreach ($this->rechte as $recht) { $th[] = $recht['RechtName']; } $table->add_th($th); for ($i = 0; $i < count($this->existent_groups); $i++) { if (isset($_GET['editgroup']) && $_GET['editgroup'] == $i) { $td = array(Form::add_input('text', 'name', $this->existent_groups[$i]['Name'])); for ($j = 0; $j < count($this->rechte); $j++) { if (in_array($this->rechte[$j]['id'], $this->existent_groups[$i]['Rechte'])) { $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id'], array('checked' => 'checked')); } else { $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id']); } } $id = Form::add_input('hidden', 'group_id', $i); $new_rechte_submit = Form::add_input('image', 'submit_rechte', 'Speichern', array('src' => $this->images['apply_path'], 'alt' => 'Speichern')); $td[] = $id . $new_rechte_submit; } else { $td = array(Html::bold($this->existent_groups[$i]['Name'])); for ($j = 0; $j < count($this->rechte); $j++) { $td[] = in_array($this->rechte[$j]['id'], $this->existent_groups[$i]['Rechte']) ? $this->images['checkbox_disabled_checked'] : $this->images['checkbox_disabled_unchecked']; } $edit_button = Html::a('/Admin/Gruppen?editgroup=' . $i, $this->images['edit'], array('title' => 'Eigenschaften bearbeiten')); $delete_button = Html::a('/Admin/Gruppen?deletegroup=' . $i, $this->images['delete_group'], array('title' => 'Gruppe löschen', 'onclick' => "return confirm('Gruppe " . $this->existent_groups[$i]['Name'] . " löschen?')")); $td[] = $edit_button; $td[] = $delete_button; } $class = is_int($i / 2) ? 'abwechselnde_flaechen_1' : 'abwechselnde_flaechen_2'; $table->add_td($td, array('class' => is_int($i / 2) ? 'abwechselnde_flaechen_1' : 'abwechselnde_flaechen_2')); } $new_group_button = Html::a('/Admin/Gruppen?newgroup', $this->images['new_group'] . ' Gruppe hinzufügen'); if (isset($_GET['newgroup'])) { $td = array(Form::add_input('text', 'name', 'Name...')); for ($j = 0; $j < count($this->rechte); $j++) { $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id']); } $new_group_submit = Form::add_input('image', 'submit_newgroup', 'Speichern', array('src' => $this->images['apply_path'], 'alt' => 'Speichern')); $td[] = $id . $new_group_submit; $table->add_td($td); } else { $table->add_td(array(array(2 => $new_group_button))); } return $form_tag . $table->flush_table() . $form_close; }
public function renderCategory($category) { $catRender = '<li>'; $catRender .= Html::a($category->name . ' (' . count($category->blogTermRelationships) . ')', ['blogposts/category', 'id' => $category->id, 'category' => $category->name]); $catRender .= '</li>'; return $catRender; }
public static function notify($thread) { if (is_numeric($thread) && $thread > 0) { $email = Content::find()->where(['name' => 'email-sub'])->one(); if ($email) { $topic = $email->topic; $content = $email->content; } else { $topic = 'New post in subscribed thread at {forum}'; $content = '<p>There has been new post added in the thread you are subscribing. Click the following link to read the thread.</p><p>{link}</p><p>See you soon!<br />{forum}</p>'; } $forum = Config::getInstance()->get('name'); $subs = static::find()->where(['thread_id' => (int) $thread, 'post_seen' => static::POST_SEEN]); foreach ($subs->each() as $sub) { $sub->post_seen = static::POST_NEW; if ($sub->save()) { if (Email::queue($sub->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['default/last', 'id' => $sub->thread_id], true), Url::to(['default/last', 'id' => $sub->thread_id], true)), $content)), !empty($sub->user_id) ? $sub->user_id : null)) { Log::info('Subscription notice link queued', !empty($sub->user_id) ? $sub->user_id : '', __METHOD__); } else { Log::error('Error while queuing subscription notice link', !empty($sub->user_id) ? $sub->user_id : '', __METHOD__); } } } } }
function printqueue_GET(Web $w) { $print_folder = FILE_ROOT . "print"; $path = realpath($print_folder); // Check if folder exists if ($path === false) { // Make print folder (If you specify a full path, use the recursion flag because it seems to crash without it in unix) // Other wise you would need to chdir to the parent folder, create and change back to wherever execution currently was at mkdir($print_folder, 0777, true); $path = realpath($print_folder); } $exclude = array("THUMBS.db"); $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $table_data = array(); $table_header = array("Name", "Size", "Date Created", "Actions"); foreach ($objects as $name => $object) { $filename = $object->getFilename(); // Ignore files starting with '.' and in exclude array if ($filename[0] === '.' || in_array($filename, $exclude)) { continue; } $table_data[] = array(Html::a("/uploads/print/" . $filename, $filename), humanReadableBytes($object->getSize()), date("H:i d/m/Y", filectime($name)), Html::box("/admin/printfile?filename=" . urlencode($name), "Print", true) . " " . Html::b("/admin/deleteprintfile?filename=" . urlencode($name), "Delete", "Are you sure you want to remove this file? (This is irreversible)")); } $w->out(Html::table($table_data, null, "tablesorter", $table_header)); }
function showarchive_ALL(Web $w) { $w->Inbox->navigation($w, "Archive"); $p = $w->pathMatch('num'); $num = $p['num'] ? $p['num'] : 1; $new_arch = $w->Inbox->getMessages($num - 1, 40, $w->Auth->user()->id, 1, 1); $arch = $w->Inbox->getMessages($num - 1, 40, $w->Auth->user()->id, 0, 1); $arch_count = $w->Inbox->getArchCount($w->Auth->user()->id); $table_header = array("<input style='margin: 0px;' type='checkbox' id='allChk' onclick='selectAll()' />", "Subject", "Date", "Sender"); $table_data = array(); if (!empty($new_arch)) { foreach ($new_arch as $q) { $table_data[] = array("<input style='margin: 0px;' type='checkbox' id='" . $q->id . "' value='" . $q->id . "' class='classChk'/>", Html::a(WEBROOT . "/inbox/view/new/" . $q->id, "<b>" . $q->subject . "</b>"), "<b>" . $q->getDate("dt_created", "d/m/Y H:i") . "</b>", "<b>" . ($q->sender_id ? $q->getSender()->getFullName() : "") . "</b>"); } } if (!empty($arch)) { foreach ($arch as $q) { $table_data[] = array("<input style='margin: 0px;' type='checkbox' id='" . $q->id . "' value='" . $q->id . "' class='classChk'/>", Html::a(WEBROOT . "/inbox/view/read/" . $q->id, $q->subject), "<b>" . $q->getDate("dt_created", "d/m/Y H:i") . "</b>", "<b>" . ($q->sender_id ? $q->getSender()->getFullName() : "") . "</b>"); } } $w->ctx("arch_table", Html::table($table_data, null, "tablesorter", $table_header)); $w->ctx('pgnum', $num); $w->ctx("readtotal", $arch_count); // $w->ctx("new_arch", $new_arch); }
/** * Displays a table of pages, either for all users or the currently logged in users pages only * based on permissions. * * Route: admin/pages/manage */ public static function manage() { // Check if user only has access to their pages if (!User::current()->hasPermission('page.manage')) { $pages = Page::page()->where('user_id', '=', User::current()->id)->orderBy('title')->all(); } else { $pages = Page::page()->orderBy('title')->all(); } $table = Html::table(); $header = $table->addHeader(); $header->addCol('Title'); $header->addCol('User', array('colspan' => 2)); if ($pages) { MultiArray::load($pages, 'page_id'); $indentedPages = MultiArray::indent(); foreach ($indentedPages as $page) { $user = User::user()->find($page->user_id); $row = $table->addRow(); $row->addCol(Html::a()->get($page->indent . $page->title, 'admin/page/edit/' . $page->id)); $row->addCol($user->email); $row->addCol(Html::a('Delete', 'admin/page/delete/' . $page->id, array('onclick' => "return confirm('Delete this page? All child pages will be deleted as well.')")), array('class' => 'right')); } } else { $table->addRow()->addCol('<em>No pages</em>', array('colspan' => 2)); } return array('title' => 'Manage Page', 'content' => $table->render()); }
/** * Display member and permission infomation * * @param <type> $w */ function moreInfo_GET(Web &$w) { $option = $w->pathMatch("group_id"); $w->Admin->navigation($w, $w->Auth->getUser($option['group_id'])->login); if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") { $w->ctx("addMember", Html::box("/admin/groupmember/" . $option['group_id'], "New Member", true)); } $w->ctx("editPermission", Html::b("/admin/permissionedit/" . $option['group_id'], "Edit Permissions")); //fill in member table; $table = array(array("Name", "Role", "Operations")); $groupMembers = $w->Auth->getGroupMembers($option['group_id']); if ($groupMembers) { foreach ($groupMembers as $groupMember) { $line = array(); $style = $groupMember->role == "owner" ? "<div style=\"color:red;\">" : "<div style=\"color:blue;\">"; $name = $groupMember->getUser()->is_group == 1 ? $groupMember->getUser()->login : $groupMember->getUser()->getContact()->getFullName(); $line[] = $style . $name . "</div>"; $line[] = $style . $groupMember->role . "</div>"; if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") { $line[] = Html::a("/admin/memberdelete/" . $option['group_id'] . "/" . $groupMember->id, "Delete", null, null, "Are you sure you want to delete this member?"); } else { $line[] = null; } $table[] = $line; } } $w->ctx("memberList", Html::table($table, null, "tablesorter", true)); }
/** * Creates a new AccionCentralizadaVariableProgramacion model. * If creation is successful, the browser will be redirected to the 'view' page. * @param integer $id_localizacion * @return mixed */ public function actionCreate($id_localizacion) { $request = Yii::$app->request; $model = new AccionCentralizadaVariableProgramacion(); $model->id_localizacion = $id_localizacion; if ($request->isAjax) { /* * Process for ajax request */ Yii::$app->response->format = Response::FORMAT_JSON; if ($request->isGet) { return ['title' => "Programación", 'content' => $this->renderPartial('_form', ['model' => $model]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])]; } else { if ($model->load($request->post()) && $model->save()) { return ['forceReload' => 'true', 'title' => "Programación", 'content' => '<span class="text-success">Create ProyectoLocalizacion success</span>', 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::a('Create More', ['create'], ['class' => 'btn btn-primary', 'role' => 'modal-remote'])]; } else { return ['title' => "Programación", 'content' => $this->renderPartial('create', ['model' => $model]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])]; } } } else { if ($model->load(Yii::$app->request->post()) && $model->save()) { //return $this->redirect(['responsable-acc-variable/create', 'id_variable' => $model->id]); return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } } }
function overview() { $this->scaff->order_by = $_GET['order'] ? $_GET['order'] : 'Stadt'; $this->scaff->group_by = 'Location_id'; $this->scaff->add_search_field('PLZ'); $this->scaff->add_search_field('Stadt'); $this->scaff->template_vars['stadt_value'] = $_GET['Stadt'] ? $_GET['Stadt'] : ''; $this->scaff->search_method = 'LIKE'; $this->scaff->template_vars['reset'] = ''; if ($_GET['PLZ'] || $_GET['PLZ'] === '0') { $_GET['PLZ'] = $this->scaff->template_vars['plz_value'] = preg_replace('/[^0-9]/', '', $_GET['PLZ']); for ($i = 0; $i < 5 - strlen($_GET['PLZ']); $i++) { $this->scaff->template_vars['plz_value'] .= 'x'; } $_GET['PLZ'] .= '%'; } else { $this->scaff->template_vars['plz_value'] = ''; } if ($stadt = $_GET['Stadt']) { $_GET['Stadt'] = "%{$stadt}%"; } if ($_GET['Stadt'] || $_GET['PLZ'] || $_GET['PLZ'] === '0') { $this->scaff->template_vars['reset'] = Html::br() . Html::a(SELF, 'Alle zeigen'); } return $this->scaff->make_table($sql, INSTALL_PATH . '/Module/LocationsFrontend/Templates/LocationsOverview.template.html'); }
function show() { $this->template = new Template(DOCUMENT_ROOT . INSTALL_PATH . '/Module/Gästebuch/Gästebuch.parts.template.html'); $this->last_id = $this->last_id(); $return_string = ''; $vars = array(); if (isset($this->gb_seite)) { $where = "WHERE `id` <= {$this->gb_seite}"; } else { $where = ''; } $eintraege = $this->connection->db_assoc("SELECT * FROM `RheinaufCMS>Gästebuch` {$where} ORDER BY `id` DESC LIMIT 0,10"); if ($next = $this->next_page()) { $vars['next_page'] = '<a href="?seite=' . $next . '#eintraege">Nächste Seite</a>'; } else { $vars['next_page'] = ''; } if ($prev = $this->prev_page()) { $vars['prev_page'] = '<a href="?seite=' . $prev . '#eintraege">Vorige Seite</a>'; } else { $vars['prev_page'] = ''; } if (isset($_GET['neu'])) { $vars['eintragen'] = $this->template->parse_template('EINTRAGEN', $vars); } $return_string .= $this->template->parse_template('HEADER', $vars); $eintrag_vars = array(); for ($i = 0; $i < count($eintraege); $i++) { $eintrag_vars['id'] = $eintraege[$i]['id']; $eintrag_vars['name'] = General::output_clean($eintraege[$i]['name']); $eintrag_tmp['email_und_url'] = array(); $eintrag_vars['email_und_url'] = ''; $email_und_url = false; if ($eintraege[$i]['email']) { $eintrag_tmp['email_und_url']['email'] = Html::a('mailto:' . $eintraege[$i]['email'], 'E-Mail'); $email_und_url = true; } if ($eintraege[$i]['url']) { $eintrag_tmp['email_und_url']['url'] = Html::a($eintraege[$i]['url'], 'Homepage'); $email_und_url = true; } if ($email_und_url) { $eintrag_vars['email_und_url'] = Html::span(implode(' | ', $eintrag_tmp['email_und_url']), array('class' => 'klein')); } $eintrag_vars['beitrag'] = General::output_clean($eintraege[$i]['beitrag']); $date = Date::timestamp2datum($eintraege[$i]['datum'], 'Array'); $eintrag_vars['eintragdatum'] = $date[0] . ' um ' . $date[1] . ' Uhr'; if ($this->check_right('GästebuchEdit')) { $eintrag_vars['admin_elemente'] = '<p><a href="?delete=' . $eintraege[$i]['id'] . '" onclick="return confirm(\'Eintrag ' . $eintraege[$i]['id'] . ' von ' . $eintraege[$i]['name'] . ' löschen?\')">Löschen</a> | '; $eintrag_vars['admin_elemente'] .= '<a href="?delete=' . $eintraege[$i]['id'] . '&ban=' . rawurlencode($eintraege[$i]['name']) . '" onclick="return confirm(\'Eintrag ' . $eintraege[$i]['id'] . ' löschen und Einträge von ' . $eintraege[$i]['name'] . ' zukünftig unterdrücken?\')">Löschen und Namen verbieten</a>'; $eintrag_vars['admin_elemente'] .= '</p>'; } $return_string .= $this->template->parse_template('EINTRÄGE', $eintrag_vars); } $vars['seiten'] = $this->pages(); $return_string .= $this->template->parse_template('FOOTER', $vars); return $return_string; }
/** * @inheritdoc */ public function run() { $html = $s = ''; foreach ($this->model->tags as $tag) { $html .= $s . Html::a(Html::encode($tag->name), ['tag/view', 'id' => $tag->id], ['class' => 'btn tag-sm', 'style' => 'background: ' . $tag->color . ';']); $s = ' '; } return $html; }
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'); }
function show() { $new_button = Html::a(SELF . '?new', 'Sprache hinzufügen', array('class' => 'button')); if (isset($_GET['new'])) { return $this->scaff->make_form(); } else { if (isset($_GET['edit'])) { return $this->scaff->make_form($_GET['edit']); } else { return $new_button . $this->scaff->make_table(); } } }
public function init() { echo '<div class="box box-primary">' . ' <div class="box-header with-border">'; echo Html::tag('h3', $this->options['boxTitle'], ['class' => 'box-title']); echo '<div class="box-tools pull-right">'; echo Html::button('<i class="fa fa-save"></i>', ['type' => 'submit', 'class' => 'btn btn-sm btn-primary', 'title' => \Yii::t('theme/widgets/box', 'Save')]); echo ' '; if (isset($this->options['buttonUndo'])) { echo Html::a('<i class="fa fa-undo"></i>', $this->options['buttonUndo'], ['class' => 'btn btn-sm btn-default', 'title' => \Yii::t('theme/widgets/box', 'Undo')]); } echo '</div>'; echo '</div>'; echo '<div class="box-body form-horizontal">'; }
public function redirect($url, $force = false, $statusCode = 302) { $params = Yii::$app->request->queryParams; // Meta redirect if (headers_sent() || ob_get_contents()) { $url = !empty($params['_return_url']) ? $params['_return_url'] : $url; $url = Url::to($url); $this->ech(Html::tag('meta', '', ['http-equiv' => 'Refresh', 'content' => '1;URL=' . $url . ''])); $this->ech(Html::a(__('Continue'), $url)); } if (!empty($params['_return_url']) && !$force) { return Yii::$app->getResponse()->redirect($params['_return_url'], $statusCode); } return parent::redirect($url, $statusCode); }
function exhibition_list($id) { $exhibition_sql = "SELECT rooms.*, indices.Raum_id,indices.Exhibition_id,indices.index\r\n\t\t\tFROM `RheinaufCMS>Exhibition>Rooms` `rooms`\r\n\t\t\tLEFT JOIN `RheinaufCMS>Exhibition>ExhibitionIndices` `indices`\r\n\t\t\t ON rooms.RoomId = indices.Raum_id\r\n\t\t\t WHERE indices.Exhibition_id = '" . $id . "'\r\n\t\t\t ORDER BY indices.index\r\n\t\t\t "; $this->rooms_list = $this->connection->db_assoc($exhibition_sql); $list1 = new HtmlList('ul', array('id' => 'drop')); $list2 = new HtmlList(); if ($this->room_name) { $name = $this->room_name; } foreach ($this->rooms_list as $room) { $list2->add_li(Html::a(SELF . '?room=' . $room['RoomId'], $room['Roomname'])); } $list1->add_li($name . $list2->flush_list()); return $list1->flush_list(); }
/** * Displays a table for managing users. */ public static function manage() { $table = Html::table(); $table->addHeader()->addCol('Role', array('colspan' => 2)); if ($roles = User::role()->all()) { foreach ($roles as $role) { $row = $table->addRow(); $row->addCol(Html::a()->get($role->name, 'admin/user/role/edit/' . $role->id)); $row->addCol(Html::a('Delete', 'admin/user/role/delete/' . $role->id, array('onclick' => "return confirm('Delete this role?')")), array('class' => 'right')); } } else { $table->addRow()->addCol('<em>No roles.</em>', array('colspan' => 2)); } return array('title' => 'Manage Roles', 'content' => $table->render()); }
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; }
/** * Displays a table of languages to be supported. * * Route: admin/multilanguage/languages/manage */ public static function manage() { $table = Html::table(); $table->addHeader()->addCol('Languages', array('colspan' => 2)); $langs = Multilanguage::language()->orderBy('name')->all(); if ($langs) { foreach ($langs as $lang) { $row = $table->addRow(); $row->addCol(Html::a()->get($lang->name, 'admin/multilanguage/languages/edit/' . $lang->id)); $row->addCol(Html::a('Delete', 'admin/multilanguage/languages/delete/' . $lang->id, array('onclick' => "return confirm('Delete this language?')")), array('class' => 'right')); } } else { $table->addRow()->addCol('<em>No languages</em>', array('colspan' => 2)); } return array('title' => 'Manage Languages', 'content' => $table->render()); }
function make_sitemap() { $return_string; for ($i = 0; $i < count($this->navi); $i++) { $rubrik = $this->navi[$i]['Rubrik']; $rubrik_enc = $this->path_encode($rubrik); $return = Html::div(Html::bold($rubrik)); for ($j = 0; $j < count($this->navi[$i]['Subnavi']); $j++) { $seite = $this->navi[$i]['Subnavi'][$j]['Seite']; $seite_enc = $this->path_encode($seite); $return .= Html::div(Html::a("/{$rubrik_enc}/{$seite_enc}", $seite)); } $return_string .= Html::div($return, array('style' => 'float:left;margin-left:40px')); } return Html::div($return_string, array('style' => 'width:500px')); }
/** * Show a Table of Contents by searching * through all modules for the file * ./help/<module>_toc.help * * @param \Web $w */ function toc_GET(Web $w) { foreach ($w->modules() as $h) { $p = HelpLib::getHelpFilePath($w, $h, null, $h . "_toc"); if ($p) { $tocs[$h] = $p; } } foreach ($tocs as $module => $path) { if ($w->Auth->allowed($module . '/index')) { $content = file_get_contents($path); $title = HelpLib::extractTitle($content); $ul[] = Html::a(WEBROOT . '/help/view/' . $module . '/' . $module . '_toc', $title ? $title : ucfirst($module)); } } $w->ctx("ul", Html::ul($ul)); }
protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-eye-open btn btn-xs btn-primary"></span>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => '0', 'data-toggle' => 'tooltip']); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-pencil btn btn-xs btn-warning"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'data-toggle' => 'tooltip']); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash btn btn-xs btn-danger"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item ?'), 'data-method' => 'post', 'data-pjax' => '0', 'data-toggle' => 'tooltip']); }; } }
function read_GET(Web $w) { $w->Inbox->navigation($w, "Read Messages"); $p = $w->pathMatch('num'); $num = $p['num']; $num ? $num : ($num = 1); $read = $w->Inbox->getMessages($num - 1, 40, $w->Auth->user()->id, 0); $read_total = $w->Inbox->getReadMessageCount($w->Auth->user()->id); $table_header = array("<input style='margin: 0px;' type='checkbox' id='allChk' onclick='selectAll()' />", "Subject", "Date", "Sender"); $table_data = array(); foreach ($read as $q => $in) { $table_data[] = array("<input style='margin: 0px;' type='checkbox' id='" . $in->id . "' value='" . $in->id . "' class='classChk'/>", Html::a(WEBROOT . "/inbox/view/read/" . $in->id, $in->subject), $in->getDate("dt_created", "d/m/Y H:i"), $in->sender_id ? $in->getSender()->getFullName() : ""); } $w->ctx("read_table", Html::table($table_data, null, "tablesorter", $table_header)); $w->ctx('pgnum', $num); $w->ctx("readtotal", $read_total); $w->ctx("read", $read); }
/** * Builds an HTML list of page links based on the given params. * * @param int $current The current page being displayed, if < 0 defaults to 1 * @param int $perPage The number of items to display per page * @param int $total The total number of possible items * @param string $url The url string used to create pagination links * * The $url string should contain a :num tag which will be replaced with the * page number for that link. * * Example for $url: * 'blog/posts/:num' * * TODO Add configs for spread */ public static function build($current, $perPage, $total, $url) { if ($perPage > $total) { return null; } // No point in paginating if we dont need it $total = ceil($total / $perPage); $spread = 5; // The number of links in center $spreadOffset = floor($spread / 2); $current = $current < 1 ? 1 : $current; // Force anything less than 1 to equal 1 $start = $current - $spreadOffset; $end = $current + $spreadOffset; if ($start < 1) { $start = 1; $end = $spread; } if ($end > $total) { $start = $total - ($spread - 1); $end = $total; } $html = '<ul class="nav pagination">'; if ($start > 1) { $html .= '<li>' . Html::a()->get('Prev', self::_url($current - 1, $url)) . '</li>'; } if ($start > 2) { $html .= '<li>' . Html::a()->get(1, self::_url(1, $url)) . '</li>'; $html .= '<li><a href="#">...</a<></li>'; } for ($i = $start; $i <= $end; $i++) { $html .= '<li>' . Html::a()->get($i, self::_url($i, $url)) . '</li>'; } if ($end < $total - 1) { $html .= '<li><a href="#">...</a<></li>'; $html .= '<li>' . Html::a()->get($total, self::_url($total, $url)) . '</li>'; } if ($end < $total) { $html .= '<li>' . Html::a()->get('Next', self::_url($current + 1, $url)) . '</li>'; } $html .= '</ul>'; return $html; }
function index_GET(Web &$w) { $w->Inbox->navigation($w, "New Messages"); // Get current page number $p = $w->pathMatch('num'); $num = !empty($p['num']) ? $p['num'] : 1; // Get count of messages and the messages for current page $new_total = $w->Inbox->getNewMessageCount(); $new = $w->Inbox->getMessages($num - 1, 40, $w->Auth->user()->id, 1); // Make new message table $header = array("<input style='margin: 0px;' type='checkbox' id='allChk' onclick='selectAll()' />", "Subject", "Date", "Sender"); $data = array(); foreach ($new as $q => $in) { $data[] = array("<input style='margin: 0px;' type='checkbox' id='" . $in->id . "' value='" . $in->id . "' class='classChk'/>", Html::a(WEBROOT . "/inbox/view/new/" . $in->id, "<b>" . $in->subject . "</b>"), $in->getDate("dt_created", "d/m/Y H:i"), $in->sender_id ? $in->getSender()->getFullName() : ""); } $w->ctx('new_table', Html::table($data, null, "tablesorter", $header)); $w->ctx('pgnum', $num); $w->ctx("newtotal", $new_total); $w->ctx("new", $new); }
/** * Displays a table of current users. */ public static function manage() { $table = Html::table(); $header = $table->addHeader(); $header->addCol('Username', array('colspan' => 2)); $users = User::user()->orderBy('email')->all(); if ($users) { foreach ($users as $user) { $row = $table->addRow(); $row->addCol(Html::a($user->email, 'admin/user/edit/' . $user->id)); if ($user->is_admin <= 0) { $row->addCol(Html::a('Delete', 'admin/user/delete/' . $user->id), array('class' => 'right', 'onclick' => "return confirm('Delete this user?')")); } else { $row->addCol(' '); } } } else { $table->addRow()->addCol('<em>No users</em>', array('colspan' => 2)); } return array('title' => 'Manage Users', 'content' => $table->render()); }
function trash_ALL(Web &$w) { $w->Inbox->navigation($w, 'Bin'); $p = $w->pathMatch('num'); $num = $p['num'] ? $p['num'] : 1; $read_del = $w->Inbox->getMessages($num - 1, 40, $w->Auth->user()->id, 0, 0, 1); //$new_del = $w->Inbox->getMessages(0,100,$w->Auth->user()->id,1,0,1); $del_count = $w->Inbox->getDelMessageCount(); $table_header = array("<input style='margin: 0px;' type='checkbox' id='allChk' onclick='selectAll()' />", "Subject", "Date", "Sender"); $table_data = array(); if (!empty($read_del)) { foreach ($read_del as $q) { $table_data[] = array("<input style='margin: 0px;' type='checkbox' id='" . $q->id . "' value='" . $q->id . "' class='classChk'/>", Html::a(WEBROOT . "/inbox/view/" . $q->id, $q->subject), $q->getDate("dt_created", "d/m/Y H:i"), $q->sender_id ? $q->getSender()->getFullName() : ""); } } $w->ctx("del_table", Html::table($table_data, null, "tablesorter", $table_header)); $w->ctx('del_count', $del_count); $w->ctx('pgnum', $num); $w->ctx('readdel', $read_del); //$w->ctx('newdel',$new_del); }
/** * @inheritdoc */ public function successMessage() { if (Yii::$app->hasModule($this->moduleID)) { $link = Html::a('try it now', Yii::$app->getUrlManager()->createUrl($this->moduleID), ['target' => '_blank']); return "The module has been generated successfully. You may {$link}."; } $output = <<<EOD <p>The module has been generated successfully.</p> <p>To access the module, you need to add this to your application configuration:</p> EOD; $code = <<<EOD <?php ...... 'modules' => [ '{$this->moduleID}' => [ 'class' => '{$this->moduleClass}', ], ], ...... EOD; return $output . '<pre>' . highlight_string($code, true) . '</pre>'; }
/** * Displays a form for creating a new translation of the current string. Also displays a table * of current translations for the current string. * * Route: admin/multilanguage/strings/manage/:id * * @param int $id The id of the string to create translations for */ public static function manageContent($id) { if (!($string = Multilanguage::stringcontent()->find($id))) { return ERROR_404; } if (isset($_POST['create_translation']) && Html::form()->validate()) { $tmpId = Multilanguage::string()->insert(array('stringcontent_id' => $string->id, 'language_id' => $_POST['language_id'], 'content' => $_POST['content'])); if ($tmpId) { Message::ok('Translation created successfully.'); unset($_POST['language_id']); // Clear selected language } else { Message::error('Error creating translation, please try again.'); } } $langs = Multilanguage::language()->orderBy('name')->all(); $sortedLangs = array('' => 'Choose One'); foreach ($langs as $l) { $sortedLangs[$l->id] = $l->name; } $form[] = array('fields' => array('language_id' => array('title' => 'Language', 'type' => 'select', 'options' => $sortedLangs, 'validate' => array('required')), 'content' => array('title' => 'Translated String', 'type' => strlen($string->content) > 25 ? 'textarea' : 'text', 'validate' => array('required'), 'default_value' => $string->content), 'create_translation' => array('type' => 'submit', 'value' => 'Create Translation'))); $table = Html::table(); $header = $table->addHeader(); $header->addCol('String'); $header->addCol('Language', array('colspan' => 2)); $translations = Multilanguage::string()->select('multilanguage_strings.*, multilanguage_languages.name AS language')->leftJoin('multilanguage_languages', 'multilanguage_languages.id', '=', 'multilanguage_strings.language_id')->where('multilanguage_strings.stringcontent_id', '=', $id)->orderBy('multilanguage_languages.name')->all(); if ($translations) { foreach ($translations as $t) { $row = $table->addRow(); $row->addCol(Html::a()->get(String::truncate($t->content, 100, '...'), 'admin/multilanguage/strings/edit/' . $id . '/' . $t->id)); $row->addCol($t->language); $row->addCol(Html::a()->get('Delete', 'admin/multilanguage/strings/delete/' . $id . '/' . $t->id, array('onclick' => "return confirm('Delete this translation?')")), array('class' => 'right')); } } else { $table->addRow()->addCol('<em>No translations.</em>', array('colspan' => 3)); } return array(array('title' => 'Create String Translation', 'content' => Html::form()->build($form)), array('title' => 'Translations', 'content' => $table->render())); }