public function __construct($scope) { $this->_scope = $scope; $this->_ckey = self::DEF_CKEY; $this->_csecret = self::DEF_CSECRET; $this->_req_token_callback = Url::site('/oauth/reqtoken/', true); }
public function render() { $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('lecture', $lecture)->bind('user', $user)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url); if ($this->action == 'add') { $lecture = ORM::factory('lecture', $this->respective_id); if ($this->check_deleted($lecture)) { return View::factory('feed/unavaliable')->render(); } } else { if ($this->action == 'canceled') { $lecture = Model_Lecture::get_lecture_from_event($this->respective_id); $event = ORM::factory('event', $this->respective_id); if ($this->check_deleted($lecture)) { return View::factory('feed/unavaliable')->render(); } $view->bind('event', $event); } } $user = ORM::factory('user', $this->actor_id); $span = Date::fuzzy_span($this->time); $feed_id = $this->id; $curr_user = Auth::instance()->get_user(); $role = $curr_user->role()->name; $comment = ORM::factory('feedcomment'); $comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC'); $comments = $comment->find_all(); $url = Url::site('profile/view/id/'); return $view->render(); }
public function render() { $span = Date::fuzzy_span($this->time); $feed_id = $this->id; $comment = ORM::factory('feedcomment'); $comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC'); $comments = $comment->find_all(); $curr_user = Auth::instance()->get_user(); $role = $curr_user->role()->name; $url = Url::site('profile/view/id/'); if ($this->action == "publish_result") { $examgroup = ORM::factory('examgroup', $this->respective_id); if ($this->check_deleted($examgroup)) { return View::factory('feed/unavaliable')->render(); } $percent = $examgroup->get_ExamGroupPercent(); $user = ORM::factory('user', $this->actor_id); $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('user', $user)->bind('percent', $percent)->bind('id', $this->respective_id)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url); } else { $exam = ORM::factory('exam', $this->respective_id); if ($this->check_deleted($exam)) { return View::factory('feed/unavaliable')->render(); } $user = ORM::factory('user', $this->actor_id); $event = ORM::factory('event', $exam->event_id); $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('exam', $exam)->bind('user', $user)->bind('event', $event)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url); } return $view->render(); }
public function action_view() { $user_id = $this->request->param('id'); $user = ORM::factory('user', $user_id); DynamicMenu::extend(array('profilemenu' => array(array('profile/view/id/' . $user_id, 'Info', 1, array()), array('profile/view/id/' . $user_id, 'Wall', 2, array())))); $view = View::factory('profile/view')->bind('user', $user); Breadcrumbs::add(array('Profile', Url::site('profile/view/id/' . $user_id))); $this->content = $view; }
/** * Method to return an anchor tag with room_name as the text and * link to the room as href */ public function toLink() { if (Acl::instance()->is_allowed('exam_edit')) { $url = Url::site('room/edit/id/' . $this->id); return Html::anchor($url, (string) $this); } else { return Html::anchor('#', (string) $this, array('onclick' => 'javascript:KODELEARN.modules.get("rooms").showMap("' . $this->id . '");return false;')); } }
protected function breadcrumbs() { parent::breadcrumbs(); $course = ORM::factory('course', Session::instance()->get('course_id')); if (!$this->request->is_ajax() && $this->request->is_initial()) { Breadcrumbs::add(array('Courses', Url::site('course'))); Breadcrumbs::add(array(sprintf($course->name), Url::site('course/summary/id/' . $course->id))); Breadcrumbs::add(array('Exercises', Url::site('exercise'))); } }
public function action_index() { $feeds = Request::factory('feed/feeds')->method(Request::GET)->execute()->body(); $post_form = Request::factory('post/form')->execute()->body(); $total_feeds = Model_Feed::get_total_feeds(); $view = View::factory('feed/index')->bind('feeds', $feeds)->bind('post_form', $post_form)->bind('total_feeds', $total_feeds); if ($this->request->is_initial()) { Breadcrumbs::add(array('Feeds', Url::site('feed'))); } $this->content = $view; }
public function delete() { $url = Registry::getUrl(); $id = $_REQUEST["id"] ? $_REQUEST["id"] : $url->vars[0]; $tipo = new Tipo($id); if ($tipo->id) { if ($tipo->delete()) { Registry::addMessage("Tipo de entrada eliminado satisfactoriamente", "success"); } } Url::redirect(Url::site("tipos")); }
public function delete() { $url = Registry::getUrl(); $id = $_REQUEST["id"] ? $_REQUEST["id"] : $url->vars[0]; $user = new User($id); if ($user->id) { if ($user->delete()) { Registry::addMessage("Usuario eliminado satisfactoriamente", "success"); } } Url::redirect(Url::site("users")); }
public function action_index() { $submitted = false; $view = View::factory('system/form')->bind('form', $form)->bind('image', $image)->bind('success', $success)->bind('upload_url', $upload_url)->bind('permission_msg', $permission_msg); $institution = ORM::factory('institution', $id = 1); $config = Config::instance(); $config_settings = $config->load('config')->as_array(); $permission_msg = ''; // if post, validate, save and redirect if ($this->request->method() === 'POST' && $this->request->post()) { if (Acl::instance()->is_allowed('system_edit')) { $submitted = true; $config_post = $this->request->post('config'); if (isset($config_post['membership'])) { $config_post['membership']; } else { $config_post['membership'] = 0; } if (isset($config_post['user_approval'])) { $config_post['user_approval']; } else { $config_post['user_approval'] = 0; } //echo $config_post['membership']; //exit; $validator = $institution->validator($this->request->post()); if ($validator->check()) { $institution->name = $this->request->post('name'); $institution->institution_type_id = $this->request->post('institutiontype_id'); $institution->logo = $this->request->post('logo'); $institution->website = $this->request->post('website'); $institution->address = $this->request->post('address'); $institution->save(); $config->load('config')->setMany($config_post); Session::instance()->set('success', 'Setting saved successfully.'); Request::current()->redirect('system'); exit; } else { $this->_errors = $validator->errors('institution'); } } else { $permission_msg = '<div class="formMessages"><span class="fmIcon bad"></span> <span class="fmText">Permission denied for editing this page.</span><span class="clear"> </span></div>'; } } $upload_url = URL::site('system/uploadinst'); $images = CacheImage::instance(); $image = $images->resize($institution->logo, 100, 100); $form = $this->form(array('name' => $institution->name, 'institutiontype_id' => $institution->institution_type_id, 'logo' => $institution->logo, 'website' => $institution->website, 'address' => $institution->address, 'config' => $config_settings), $submitted); Breadcrumbs::add(array('System', Url::site('system'))); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $this->content = $view; }
public function action_index() { $oauth = Google_Oauth::factory(Google_Oauth::SPREADSHEETS); $oauth->_req_token_callback = Url::site('/upload/auth', true); $auth_token = $oauth->get_req_token(); if (!$auth_token) { throw new Exception('Could not obtain auth token.'); } $secret = $auth_token['oauth_token_secret']; Session::instance()->set('oauth_token_secret', $secret); unset($auth_token['oauth_token_secret']); $this->request->redirect(Google_Oauth::OAUTH_BASE . Google_Oauth::OAUTH_AUTHTOKEN . Url::query($auth_token)); }
public function action_feed() { $info = array('title' => __($this->metadata->title), 'pubDate' => date('r'), 'description' => $this->metadata->description, 'language' => I18n::lang(), 'ttl' => 60); $news = ORM::factory('Publication')->where('published', '=', 1)->order_by('date', 'desc')->limit(40)->find_all(); $items = array(); foreach ($news as $item) { $items[] = array('title' => $item->title, 'description' => strip_tags($item->desc), 'image' => isset($item->picture->file_path) && $item->picture->file_path ? URL::media($item->picture->file_path, TRUE) : '', 'content' => strip_tags($item->text), 'link' => Url::site('publications/view/' . $item->id, true), 'pubDate' => date('r', strtotime($item->date))); } header('Content-Type: text/xml; charset=utf-8'); $xml = Feed::create($info, $items, 'UTF-8'); echo $xml; die; }
public function action_index() { $view = View::factory('calendar/index')->bind('calendar', $calendar)->bind('day_events', $day_events)->bind('month', $month)->bind('year', $year)->bind('months', $months)->bind('years', $years); $month = Arr::get($_GET, 'month', date('m')); $year = Arr::get($_GET, 'year', date('Y')); Breadcrumbs::add(array('Calendar', Url::site(sprintf('calendar?month=%s&year=%s', $month, $year)))); $calendar = Request::factory('calendar/calendar')->method(Request::GET)->execute()->body(); $day_events = Request::factory('calendar/day_events')->method(Request::GET)->execute()->body(); $months = array_map(array(__CLASS__, 'month_names'), Date::months()); // var_dump($months); exit; $present_year = date('Y'); $years = range($present_year - 10, $present_year + 10); $this->content = $view; }
public function delete() { $url = Registry::getUrl(); $id = $_REQUEST["id"] ? $_REQUEST["id"] : $url->vars[0]; $mosca = new Mosca($id); if ($mosca->id) { if ($mosca->delete()) { Registry::addMessage("Mosca eliminada satisfactoriamente", "success"); //Log Log::add(LOG_DELETE_MOSCA, $mosca); } } Url::redirect(Url::site("moscas")); }
/** * Login action */ public function doLogin() { $user = User::login($_REQUEST['login'], $_REQUEST['password']); //Try to login if ($user->id) { //Add success message Registry::addMessage("", "", "", Url::site()); } else { //Add error message and redirect to login form view Registry::addMessage("Datos incorrectos", "error", "login"); } //Show ajax JSON response $this->ajax(); }
public function action_index() { $user = Auth::instance()->get_user(); $submitted = FALSE; if ($this->request->method() === 'POST' && $this->request->post()) { if (Arr::get($this->request->post(), 'save') !== null) { $submitted = true; $validator = $user->validator_profile($this->request->post()); $validator->bind(':user', $user); if ($validator->check()) { $user->firstname = $this->request->post('firstname'); $user->lastname = $this->request->post('lastname'); $user->email = $this->request->post('email'); $user->about_me = $this->request->post('about_me'); if ($this->request->post('password')) { $user->password = Auth::instance()->hash($this->request->post('password')); } $user->save(); Session::instance()->set('success', 'Saved successfully.'); Request::current()->redirect('account'); } else { $this->_errors = $validator->errors('register'); } } } $form = new Stickyform('account/index', array(), $submitted ? $this->_errors : array()); $form->default_data = array('firstname' => '', 'lastname' => '', 'email' => '', 'about_me' => ''); $form->saved_data = array('firstname' => $user->firstname, 'lastname' => $user->lastname, 'email' => $user->email, 'about_me' => $user->about_me); $form->posted_data = $submitted ? $this->request->post() : array(); $form->append('First Name', 'firstname', 'text'); $form->append('Last Name', 'lastname', 'text'); $form->append('Email', 'email', 'text'); $form->append('Password', 'password', 'password'); $form->append('About me', 'about_me', 'textarea'); $form->append('Confirm Password', 'confirm_password', 'password'); $form->append('Save Changes', 'save', 'submit', array('attributes' => array('class' => 'button'))); $form->process(); $upload_url = URL::site('account/uploadavatar'); $remove_url = URL::site('account/removeimage'); $image = CacheImage::instance(); $avatar = $image->resize($user->avatar, 100, 100); $view = View::factory('account/profile')->bind('form', $form)->bind('upload_url', $upload_url)->bind('remove_url', $remove_url)->bind('user', $user)->bind('success', $success)->bind('avatar', $avatar); Breadcrumbs::add(array('Profile', Url::site('account'))); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $this->content = $view; }
public function action_config() { $max_size = strtolower(trim(ini_get('upload_max_filesize'))); $max_size = preg_replace('/([kmg])b/i', '$1', $max_size); $sizer = substr($max_size, -1); $max_size = (int) $max_size; switch ($sizer) { case 'g': $max_size *= 1024; case 'm': $max_size *= 1024; case 'k': $max_size *= 1024; } $config = array('url' => Url::base(TRUE, TRUE) . Route::get('torn/upload')->uri(), 'cancel' => Url::base(TRUE, TRUE) . Route::get('torn/cancel')->uri(array('hash' => '--hash--')), 'swf' => Url::site('torn/media/TUploader.swf'), 'max_size' => $max_size, 'filters' => array(__('All files') => '*.*'), 'messages' => array('file_is_too_big' => __('File is too big'), 'config_error' => __('Torn Uploader: IO error (config)'), 'io_error' => __('The file could not be uploaded'), 'select_file' => __('Select file'), 'confirm' => __('Are you sure?'), 'cancel' => __('Cancel'), 'error' => __('Error'), 'done' => __('Done'))); $this->request->response = json_encode($config); }
protected function _format_feed_array($items) { $output = array(); foreach ($items as $value) { $output[] = array('title' => $value->title, 'link' => date('Y/m/d/' . $value->slug, $value->created), 'description' => '<![CDATA[' . $value->cached_content . ']]>', 'pubDate' => $value->created, 'source' => Url::site('feed.rss', 'http')); // Handle pub/last build if ($value->created > $this->_pub_date) { $this->_pub_date = $value->created; } if (NULL !== $value->modified) { $this->_last_build = $value->modified; } } if (NULL === $this->_last_build) { $this->_last_build = $this->_pub_date; } return $output; }
public function render() { $span = Date::fuzzy_span($this->time); $flashcard = ORM::factory('flashcard', $this->respective_id); if ($this->check_deleted($flashcard)) { return View::factory('feed/unavaliable')->render(); } $user = ORM::factory('user', $this->actor_id); $feed_id = $this->id; $comment = ORM::factory('feedcomment'); $comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC'); $comments = $comment->find_all(); $curr_user = Auth::instance()->get_user(); $role = $curr_user->role()->name; $url = Url::site('profile/view/id/'); $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('flashcard', $flashcard)->bind('user', $user)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url); return $view->render(); }
public function __construct($params = null) { $action = self::DEFAULT_ACTION; if (is_array($params)) { if (isset($params['action'])) { $action = $params['action']; unset($params['action']); } } $this->action = $action; parent::__construct($params); $this->parameters['limit'] = $this->limit; $this->parameters['offset'] = $this->offset; if (isset($this->parameters['q'])) { $this->parameters['name'] = $this->parameters['q']; } $this->headers['Referer'] = Url::site('', true); $this->parameters['key'] = $this->_api_key; }
public function render() { $user = ORM::factory('user', $this->actor_id); $event = ORM::factory('event', $this->respective_id); if ($this->check_deleted($event)) { return View::factory('feed/unavaliable')->render(); } $attendance = $event->get_Attendance(); $class = 'Event_' . $event->eventtype; $dynamic_object = new $class($this->respective_id); $event_details = $dynamic_object->get_event_details(); $span = Date::fuzzy_span($this->time); $feed_id = $this->id; $comment = ORM::factory('feedcomment'); $comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC'); $comments = $comment->find_all(); $curr_user = Auth::instance()->get_user(); $role = $curr_user->role()->name; $url = Url::site('profile/view/id/'); $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('user', $user)->bind('event', $event)->bind('event_details', $event_details)->bind('attendance', $attendance)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url); return $view->render(); }
public function export() { $date = date("Y-m-d", strtotime($_REQUEST["fecha"])); //Force order Evento::actualizarFechas($date); $eventos = Evento::select(array("fecha" => $date)); $output = ""; if (count($eventos)) { foreach ($eventos as $i => $evento) { $output .= $evento->telson($i == 0) . "\n"; } $filename = date("Ymd", strtotime($evento->getFecha())) . "Tribo.txt"; header('Content-Type: text/plain'); header("Content-Disposition: attachment; filename=" . $filename); echo clearDiacritics($output); //Log Log::add(LOG_EXPORT_PARRILLA, $_REQUEST); exit; } else { Registry::addMessage("Esta parrilla no tiene eventos", "error"); Url::redirect(Url::site("parrilla")); } }
public function render() { $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('post', $post)->bind('user', $user)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url)->bind('link', $query)->bind('video', $query_video); $feed_id = $this->id; $post = ORM::factory('post', $this->respective_id); $user = ORM::factory('user', $this->actor_id); $curr_user = Auth::instance()->get_user(); $role = $curr_user->role()->name; $span = Date::fuzzy_span($this->time); $comment = ORM::factory('feedcomment'); $comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC'); $comments = $comment->find_all(); $url = Url::site('profile/view/id/'); $query = ""; if ($post->link == 'link') { $query = DB::select('key', 'value')->from('post_meta')->where('post_id', '=', $post->id)->execute()->as_array('key', 'value'); } $query_video = ""; if ($post->link == 'video') { $query_video = DB::select('key', 'value')->from('post_meta')->where('post_id', '=', $post->id)->execute()->as_array('key', 'value'); } return $view->render(); }
public function action_login() { $this->template->action = 'Login'; // Error message $error = NULL; if (NULL !== $this->_user) { $this->response->headers['Location'] = Url::site(); return; } // Try to login the user if ($this->request->method === 'POST') { if ($this->_kuaas->login($_POST['email'], $_POST['password'])) { $this->request->redirect(Route::get('home')->uri(), 202); } $this->response->status = 401; $error = 'Email address or password was not found! Have you changed your email address recently?'; } // Show the login page $user = Sprig::factory('User'); // Create for inputs $form = array($user->label('email') => $user->input('email', array('id' => 'email')), $user->label('password') => $user->input('password', array('id' => 'password'))); $this->template->login = $form; $this->template->error = $error; }
echo $page - 1; ?> </a> <?php } ?> <span class="page selected btn btn-small btn-info"><?php echo $page; ?> </span> <?php if ($page < $max_page) { ?> <a class="page btn btn-small" href="<?php echo Url::site($link) . URL::query(array($key => $page + 1)); ?> "><?php echo $page + 1; ?> </a> <a class="page next btn btn-small" href="<?php echo Url::site($link) . URL::query(array($key => $max_page)); ?> "><i class="icon-chevron-right"></i></a> <?php } ?> </div> </div> <div class="clear"></div> </div>
echo $exam->name; ?> "</b> has been scheduled on <?php echo $exam->format_scheduled_date(); ?> as a part of the course <?php echo $exam->course->name; ?> for <?php echo $exam->examgroup; ?> . <br/> The exam is going to be held in <?php echo $exam->location(); ?> between <?php echo $exam->format_starttime(); ?> to <?php echo $exam->format_endtime(); ?> . <br/> Please visit <a href="<?php echo Url::site('home'); ?> ">Kodelearn</a> for more details and updates. <br/> </p>
{ if (error==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT) { alert('Файл превысил допустимый размер'); } } }); var storage; function getFileName(id) { var str; $.ajax({ url :'<?php echo Url::site('ajax/filename'); ?> ', data :{storage_id:id,token: "<?php echo Security::token(true); ?> "}, type :'POST', success:function (result) { if (result != '') { var str = "<span><input type='hidden' name='presskit' id='presskit' value='" + id +"' />"; $("#presskit-wrapper").append(str); str = "<div>" + result + " <i class='icon-remove unset' style='cursor:pointer;'></i></div>"; $("#file").html(str);
public function action_agree() { $id = (int) $this->request->param('id', 0); if (!Auth::instance()->logged_in()) { Message::success(i18n::get('You can not participate in this debate')); $this->redirect('debate', 301); } $debate = ORM::factory('Debate', $id); $nowdate = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s', strtotime("+36 hours", strtotime($debate->date))); if ($debate->opponent_email == Auth::instance()->get_user()->email and $debate->is_closed == 0 and $debate->is_public == 0 or $date < $nowdate) { $date = date('Y-m-d H:i:s'); $debate->start_time = $date; $debate->end_time = date('Y-m-d H:i:s', strtotime("+" . $debate->lifetime . " hours", strtotime($date))); $debate->opponent_id = Auth::instance()->get_user()->id; $debate->is_public = 1; $debate->replier_id = $debate->author_id; $debate->save(); $user_id = Auth::instance()->get_user()->id; $user = ORM::factory('User', $debate->author_id); $email = $user->profile->email; $opponent = $user->username; $user = ORM::factory('User', $user_id); $author = $user->username; $debate_link = Url::site("debate/view/" . $debate->id, true); Message::success(i18n::get('You have agreed to participate in the debates. Notification to this effect was sent to your opponent')); Email::connect(); Email::View('debate_agree'); Email::set(array('opponent' => $opponent, 'author' => $author, 'link' => 'e-history.kz', 'theme' => "<a href='" . $debate_link . "'>'" . $debate->title . "'</a>")); Email::send($email, array('*****@*****.**', 'e-history.kz'), __("Ваш оппонент согласился участвовать в дебатах на портале :link", array(':link' => 'History.kz')), '', true); $this->redirect('debate/view/' . $id, 301); } else { if ($date < $nowdate) { Message::success(i18n::get('Expired 36 hours during which you could agree to take part in the debate')); } else { Message::success(i18n::get('You can not give consent to participate in this debate')); } $this->redirect('debate', 301); } }
fnSuccess: function (response) { //console.log("test"); } }); return table; } $(document).ready(function () { //Select2 Entradas $(".select2entradas").select2({ placeholder: "Crear entrada", minimumInputLength: 1, ajax: { url: "<?php echo Url::site('parrilla/entradasJs'); ?> ", dataType: 'json', data: function (term) { return { q: term, }; }, results: function (data) { return { results: $.map(data.data.entradas, function (item) { return { id: item.id, text: item.nombre + " (" + item.houseNumber + ")" }
public function delete() { $url = Registry::getUrl(); $id = $_REQUEST["id"] ? $_REQUEST["id"] : $url->vars[0]; $entrada = new Entrada($id); if ($entrada->id) { if ($entrada->delete()) { Registry::addMessage("Entrada eliminada satisfactoriamente", "success"); //Log Log::add(LOG_DELETE_ENTRADA, $entrada); } } Url::redirect(Url::site("entradas")); }