public function __construct() { parent::__construct(); $this->template->tasks = array(array('admin/blog/create', __('New Post')), array('admin/blog/comments', __('All comments')), array('admin/blog/settings', __('Edit Settings'))); $this->head->title->append('Blog'); $this->template->title = html::anchor('admin/blog', 'Blog') . ' | '; }
public function add_photo($id) { $album = ORM::factory("item", $id); access::required("view", $album); access::required("add", $album); access::verify_csrf(); $file_validation = new Validation($_FILES); $file_validation->add_rules("Filedata", "upload::valid", "upload::type[gif,jpg,png,flv,mp4]"); if ($file_validation->validate()) { // SimpleUploader.swf does not yet call /start directly, so simulate it here for now. if (!batch::in_progress()) { batch::start(); } $temp_filename = upload::save("Filedata"); try { $name = substr(basename($temp_filename), 10); // Skip unique identifier Kohana adds $title = item::convert_filename_to_title($name); $path_info = pathinfo($temp_filename); if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) { $movie = movie::create($album, $temp_filename, $name, $title); log::success("content", t("Added a movie"), html::anchor("movies/{$movie->id}", t("view movie"))); } else { $photo = photo::create($album, $temp_filename, $name, $title); log::success("content", t("Added a photo"), html::anchor("photos/{$photo->id}", t("view photo"))); } } catch (Exception $e) { unlink($temp_filename); throw $e; } unlink($temp_filename); } print "File Received"; }
public function action_addFolder() { $properties = array(); $properties["owner"] = Wi3::inst()->sitearea->auth->user; $properties["adminright"] = Wi3::inst()->sitearea->auth->user->username; $properties["title"] = "Nieuwe map"; $properties["type"] = "folder"; $properties["created"] = time(); $properties["filename"] = $properties["created"]; // needs to be unique $settings = array(); if (isset($_POST["refid"]) and !empty($_POST["refid"]) and isset($_POST["location"]) and !empty($_POST["location"])) { $settings["under"] = (int) preg_replace("/[^0-9]/", "", $_POST["refid"]); } // Add it $folder = Wi3::inst()->sitearea->files->add($properties, $settings); if ($folder) { // Remove cache of everything, since we do not know how this change affects the site Wi3::inst()->cache->removeAll(); $li = html::anchor($folder->id, $folder->title); if ($folder->lft == 1 and $folder->rgt == 2) { // The new folder is the only folder there is. For the javascript menu to work properly, we need to reload the page. echo json_encode(array("scriptsbefore" => array("reload" => "window.location.reload();"))); } else { echo json_encode(array("alert" => "map is aangemaakt", "scriptsafter" => array("adminarea.currentTree().addNode('treeItem_" . $folder->id . "','" . addslashes($li) . "')"))); } } else { echo json_encode(array("alert" => "map kon NIET aangemaakt worden")); } }
public function __construct() { parent::__construct(); // Inicio de Session $this->session = Session::instance(); // Si la variable cat no está definida, definirla if (!isset($_SESSION['cat'])) { $_SESSION['cat'] = 0; } if (!isset($_SESSION['localidad'])) { $_SESSION['localidad'] = 0; } $this->template->links = array('Acerca de IMGListados' => 'about', 'Datos' => 'datos', 'Rubros' => 'rubros', 'Exportar Listados' => 'listados'); $this->template->footer = 'Copyright ' . $this->thiYear($this->y) . ' - ' . html::anchor('http://www.imgdigital.com.ar', 'IMG Digital', array('target' => '_blank')) . '- ' . html::anchor('http://www.imgdigital.com.ar/imglistados', 'IMGListados', array('target' => '_blank')); $this->template->login = new View('login'); // Da acceso a todos los controladores la base de datos $this->db = Database::instance(); //Listado de Categorías $this->categorias = ORM::factory('categoria')->select_list(); //$this->template->cats = $this->categorias; //Listado de Localidades $this->localidades = ORM::factory('localidad')->select_list(); //$this->template->localidades = $this->localidades; //$this->profiler = new Profiler; }
public function index() { $subview = new View('generic/grid'); $subview->tab = 'main'; $subview->section = 'general'; // What are we working with here? $base = $this->getBaseModelObject(); // Setup the base grid object $grid = jgrid::grid('Location', array('caption' => 'Locations')); // If there is a base model that contains an account_id, // then we want to show locations only that relate to this account $base = $this->getBaseModelObject(); if ($base and !empty($base['account_id'])) { // Set a where clause, if we're playing plug-in to someone else $grid->where('account_id = ', $base['account_id']); } // Add the base model columns to the grid $grid->add('location_id', 'ID', array('hidden' => TRUE, 'key' => TRUE)); $grid->add('name', 'Name'); $grid->add('domain', 'Domain'); // Add the actions to the grid $grid->addAction('locationmanager/edit', 'Edit', array('arguments' => 'location_id', 'attributes' => array('class' => 'qtipAjaxForm'))); $grid->addAction('locationmanager/delete', 'Delete', array('arguments' => 'location_id', 'attributes' => array('class' => 'qtipAjaxForm'))); // Produces the grid markup or JSON $subview->grid = $grid->produce(); $subview->gridMenu = html::anchor('/locationmanager/create', '<span>Add New Location</span>', array('class' => 'qtipAjaxForm')); // Add our view to the main application $this->views[] = $subview; }
public function __construct() { parent::__construct(); $this->template->tasks = array(array('admin/user/create', __('New User'))); $this->head->title->append(__('User')); $this->template->title = html::anchor('admin/user', __('User')) . ' | '; }
public function action_index() { $calendar = new Calendar(Arr::get($_GET, 'month', date('m')), Arr::get($_GET, 'year', date('Y'))); $calendar->attach($calendar->event()->condition('timestamp', time())->output(html::anchor('http://google.de', 'google'))); $data = array('content' => $calendar->render()); $this->request->response = new View('index', $data); }
/** * **************************************************** * HOME * **************************************************** */ function index() { $vars = array(); $img = array(); $vars['img'] =& $img; $img['up'] = 'images/icons/up.png'; $img['down'] = 'images/icons/down.png'; $img['edit'] = 'images/icons/edit.png'; $img['delete'] = 'images/icons/delete.png'; // action & id $action = $this->validate->get->getRaw('action'); $action_list = array(); if (in_array($action, $action_list)) { $this->{$action}(); } $vars['nagavitor'] = $this->forum->get_nagavitor(); $vars['board_move_data'] = $this->forum->get_redirect_data(); $cats = $this->forum->get_category(); $vars['cats'] = array(); foreach ($cats as $key => $cat) { $newcat = array(); $newcat['up'] = $newcat['down'] = ''; if ($key - 1 >= 0) { $newcat['up'] = html::anchor('forum.php?c=admin&m=movecat&cat1=' . $cat['cat_id'] . '&order1=' . $cat['cat_order'] . '&cat2=' . $cats[$key - 1]['cat_order'] . '&order2=' . $cats[$key - 1]['cat_order'], html::img($img['up'])); } if ($key + 2 <= count($cats)) { $newcat['down'] = html::anchor('forum.php?c=admin&m=movecat&cat1=' . $cat['cat_id'] . '&order1=' . $cat['cat_order'] . '&cat2=' . $cats[$key + 1]['cat_id'] . '&order2=' . $cats[$key + 1]['cat_order'], html::img($img['down'])); } $newcat['id'] = $cat['cat_id']; $newcat['name'] = $cat['name']; $vars['cats'][$key] = $newcat; unset($newcat); $vars['cats'][$key]['boards'] = array(); $catkey = $key; // get the board data $boards = array(); $this->forum->get_board_list2($cat['cat_id'], 0, $boards); foreach ($boards as $key => $board) { $newboard = array(); $newboard['up'] = $newboard['down'] = ''; $min_order = $this->forum->get_board_min_order($cat['cat_id'], $board['child_level'], $board['parent_id']); $max_order = $this->forum->get_board_max_order($cat['cat_id'], $board['child_level'], $board['parent_id']); if ($board['board_order'] > $min_order) { $newboard['up'] = html::anchor('forum.php?c=admin&m=moveboard&board1=' . $board['board_id'] . '&order1=' . $board['board_order'] . '&board2=' . $boards[$key - 1]['board_id'] . '&order2=' . $boards[$key - 1]['board_order'], html::img($img['up'])); } if ($board['board_order'] < $max_order) { $newboard['down'] = html::anchor('forum.php?c=admin&m=moveboard&board1=' . $board['board_id'] . '&order1=' . $board['board_order'] . '&board2=' . $boards[$key + 1]['board_id'] . '&order2=' . $boards[$key + 1]['board_order'], html::img($img['down'])); } $newboard['level'] = $board['child_level']; $newboard['id'] = $board['board_id']; $newboard['name'] = $board['name']; $newboard['child_level'] = $board['name']; $newboard['parent'] = $board['parent_id']; $vars['cats'][$catkey]['boards'][] = $newboard; unset($newboard); } } $this->view->render('admin/index', $vars); }
public function load() { $view = new View('report/view'); $this->template->title = 'Report Output'; $this->template->content = $view; $this->page_breadcrumbs[] = html::anchor('report_viewer', 'Report Browser'); $this->page_breadcrumbs[] = $this->template->title; }
/** * Test button link creation */ function testButtonLinkCreation() { $SUT = new Grid_Link('button'); $SUT->action('controller/method')->text('someText'); $link = $SUT->render(); $expected = html::anchor('controller/method', '<button type="button">someText</button>'); $this->assertEquals($expected, $link); }
public function provideHelpLink() { $session = Session::instance(); $flashMessage =& Event::$data; $hash = 'message_' . time(); $session->set($hash, $flashMessage); $flashMessage .= html::anchor('errorreporter/inform/' . $hash, 'Help!', array('class' => 'support_help qtipAjaxForm', 'style' => 'float:right;')); }
public static function getlastnews() { $orm = new fpp_news_Model(); $orm = $orm->db2cls(); $q = $orm->limit(0, 5)->fetch_all('id_news', 'DESC'); $pages = html::anchor(url::base() . 'webserv/listnews/', "Ver mas"); return View::factory("extras/news/lastnews")->set("news", $q)->set("pages", $pages)->render(); }
public function index() { $user = user::active(); user::logout(); log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/{$user->id}", $user->name)); if ($this->input->get("continue")) { url::redirect($this->input->get("continue")); } }
private function _user_info() { if ($user = $this->a2->get_user()) { $s = '<b>' . $user->username . ' <i>(' . $user->role . ')</i></b> ' . html::anchor('a2demo/logout', 'Logout'); } else { $s = '<b>Guest</b> ' . html::anchor('a2demo/login', 'Login') . ' - ' . html::anchor('a2demo/create', 'Create account'); } return '<div style="width:100%;padding:5px;background-color:#AFB6FF;">' . $s . '</div>'; }
function nagavitor($nagavitor, $seperator = '::') { $sets = array(); foreach ($nagavitor as $k => $v) { $sets[] = html::anchor($v[0], $v[1]); } $sets = array_reverse($sets); return implode(' ' . $seperator . ' ', $sets); }
/** * Test action column */ public function testActionColumn() { $SUT = new Grid_Column_Action(); $SUT->action('controller/method')->text('click me'); $data = array('id' => 42); $cell = $SUT->render($data); $url = html::anchor('controller/method/42', 'click me'); $this->assertEquals($url, $cell); }
public function add_photo($id) { $album = ORM::factory("item", $id); access::required("view", $album); access::required("add", $album); access::verify_csrf(); // The Flash uploader not call /start directly, so simulate it here for now. if (!batch::in_progress()) { batch::start(); } $form = $this->_get_add_form($album); // Uploadify adds its own field to the form, so validate that separately. $file_validation = new Validation($_FILES); $file_validation->add_rules("Filedata", "upload::valid", "upload::required", "upload::type[" . implode(",", legal_file::get_extensions()) . "]"); if ($form->validate() && $file_validation->validate()) { $temp_filename = upload::save("Filedata"); Event::add("system.shutdown", create_function("", "unlink(\"{$temp_filename}\");")); try { $item = ORM::factory("item"); $item->name = substr(basename($temp_filename), 10); // Skip unique identifier Kohana adds $item->title = item::convert_filename_to_title($item->name); $item->parent_id = $album->id; $item->set_data_file($temp_filename); // Remove double extensions from the filename - they'll be disallowed in the model but if // we don't do it here then it'll result in a failed upload. $item->name = legal_file::smash_extensions($item->name); $path_info = @pathinfo($temp_filename); if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), legal_file::get_movie_extensions())) { $item->type = "movie"; $item->save(); log::success("content", t("Added a movie"), html::anchor("movies/{$item->id}", t("view movie"))); } else { $item->type = "photo"; $item->save(); log::success("content", t("Added a photo"), html::anchor("photos/{$item->id}", t("view photo"))); } module::event("add_photos_form_completed", $item, $form); } catch (Exception $e) { // The Flash uploader has no good way of reporting complex errors, so just keep it simple. Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); // Ugh. I hate to use instanceof, But this beats catching the exception separately since // we mostly want to treat it the same way as all other exceptions if ($e instanceof ORM_Validation_Exception) { Kohana_Log::add("error", "Validation errors: " . print_r($e->validation->errors(), 1)); } header("HTTP/1.1 500 Internal Server Error"); print "ERROR: " . $e->getMessage(); return; } print "FILEID: {$item->id}"; } else { header("HTTP/1.1 400 Bad Request"); print "ERROR: " . t("Invalid upload"); } }
public static function anchor($page, $title = NULL, array $attributes = NULL, array $query = NULL, $retain_get = FALSE, $protocol = NULL) { if ($retain_get) { // merge with the current $_GET $query = array_merge((array) $query, $_GET); } //create query string $query = http_build_query((array) $query); return html::anchor(Route::get('page')->uri(array('uri' => $page)) . '?' . $query, $title, $attributes, $protocol); }
/** * Méthode : verifie qu'on est login */ protected function login() { if (!$this->user) { if (request::is_ajax()) { die(html::anchor(NULL, 'Veuillez vous identifier')); } else { return url::redirect('auth'); } } }
public static function get_public_account_link($user = NULL) { if ($user === NULL) { $user = Auth::instance()->get_user(); } if (empty($user->vanity_url)) { $html = html::anchor('profile/' . $user->id, $user->display_name); } else { $html = html::anchor('profile/' . $user->vanity_url, $user->display_name); } return $html; }
public function before() { parent::before(); if (!Kohana::config('github')->login) { $msg = 'Please add your login credentials to the configuration file.<br/>'; $msg .= 'Look here for your login credentials: ' . html::anchor('https://github.com/account'); die($msg); } // github info can be passed by reference or set in config // Github::instance($format, $user, $token) $this->g = Github::instance(); }
/** * Output the menu items * @developer Brandon Hansen * @date May 23, 2010 */ public static function output($echo = true) { $menu = NULL; foreach (self::$items as $url => $text) { $menu .= html::anchor($url, $text) . "\t\n"; } if ($echo) { echo $menu; } else { return $menu; } }
public function action_index() { if ($user = Arr::get($_GET, 'user') or $user = Arr::get($_GET, 'user_id')) { $user_id = $user; } $gallery_detail = ORM::factory('photo')->where('moderation_status_id', '=', '2')->where('user_id', '=', $user)->with('category')->with('user')->find_all(); $json = array(); foreach ($gallery_detail as $key => $photo) { $json[] = array('category' => html::anchor('categories/' . $photo->category->id, $photo->category->name), 'share' => html::anchor('#', 'Share this photo'), 'current' => $key + 1, 'total' => $gallery_detail->count(), 'photo' => html::image(Helper_Photos::get($photo, 'medium')), 'display_name' => html::anchor('profile/' . $photo->user->username, $photo->user->display_name), 'name' => $photo->name, 'caption' => $photo->caption, 'tags' => Helper_Tags::print_tags($photo->tags->find_all())); } $this->resource = $json; }
private function build_thumbnails() { $thumbnails = NULL; foreach ($this->photos as $key => $photo) { $class = ($key + 1) % $this->last_index == 0 ? ' last' : ''; $thumbnails .= View::factory($this->thumbnail_template)->set(array('photo' => $photo, 'class' => $class))->render(); } if (empty($thumbnails)) { $thumbnails = '<p>No photos here! ' . html::anchor('photos/upload', 'Upload now!') . '</p>'; } $this->template->thumbnails = $thumbnails; }
static function logout() { $user = identity::active_user(); if (!$user->guest) { try { Session::instance()->destroy(); } catch (Exception $e) { Kohana::log("error", $e); } module::event("user_logout", $user); } log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/{$user->id}", html::clean($user->name))); }
public function __construct() { parent::__construct(); new Profiler(); echo '<b>See source for usage, use links & profiler to verify output</b><br>'; echo 'You probably want to refresh each demo to see when the DB is used and when it isn\'t<br>'; for ($i = 1; $i < 12; $i++) { echo html::anchor('cormdemo/demo' . $i, 'demo ' . $i), '<br>'; } echo '<hr>'; echo html::anchor('cormdemo/db', 'db schema'), '<br>'; echo html::anchor('cormdemo/flush', 'empty cache'), '<hr>'; }
public function archive($build = FALSE) { if ($build === 'build') { // Load archive $archive = new Archive('zip'); // Download the application/views directory $archive->add(APPPATH . 'views/', 'app_views/', TRUE); // Download the built archive $archive->download('test.zip'); } else { echo html::anchor(Router::$current_uri . '/build', 'Download views'); } }
public static function print_tags($tags, $link = TRUE) { $html = NULL; foreach ($tags as $tag) { if ($link !== TRUE) { $html .= $tag->name . ', '; } else { $html .= html::anchor('tags/view/' . $tag->id, $tag->name) . ', '; } } $html = substr($html, 0, -2); return $html; }
/** * Define non-standard behaviuor for the breadcrumbs, since this is accessed via a subject observation */ protected function defineEditBreadcrumbs() { $this->page_breadcrumbs[] = html::anchor('subject_observation', 'Subject Observations'); if ($this->model->id) { // editing an existing item $soId = $this->model->subject_observation_id; } else { // creating a new one so our argument is the subject obs id $soId = $this->uri->argument(1); } $so = ORM::factory('subject_observation', $soId); $this->page_breadcrumbs[] = html::anchor('subject_observation/edit/' . $so, $so->caption()); $this->page_breadcrumbs[] = $this->model->caption(); }
public function __list() { $html = "<ul style='list-style:none'>"; $directory = APPPATH . '/views/snippets/'; $files = zest::dir_to_array($directory); foreach ($files as $file) { $filename = str_replace('.zest', '', $file); $display_name = ucwords(str_replace('_', ' ', $filename)); $html .= "<li style='padding-left:45px !important;' class='snippet'><div class='right'> " . html::anchor('admin/snippets/edit/' . $filename, html::image('zest/images/icon_pencil.png')) . "</div><span>" . $display_name . "</span></li>"; // tidy up: close the handler } $html .= "</ul>"; return $html; }