public function placeorder() { if ($this->current) { $this->template->title = 'Place Order for Sample or Dummy'; $view = new View(url::area() . 'placeorder'); $view->user = $this->current; $view->breadcrumbs = $this->breadcrumbs->add()->url(false)->title('Place Order')->cut(); $this->template->content = $view; } else { //$this->notification->add($this->i18n['security.login.fail']); url::failed(url::current()); } }
/** * This function will set all the defaults for the base controllers * default template, page title, etc and set up each of the classes that * we might use later on, notification, breadcrumbs, navigation, security. * * @author Jamie Peake */ protected function init() { // initialise the default template data $this->template->title = ''; $this->template->content = ''; $this->notification = Notification::instance(); $this->breadcrumbs = new Breadcrumbs(); $this->breadcrumbs->add()->url('home')->title('Home'); // add the home location. $this->navigation = Navigation::instance('main'); $this->access = Access::instance(); $this->current = $this->access->get_user(); $this->i18n = Kohana::lang(url::area() . Router::$method); $this->post = Session::instance()->get('post'); // this is a simple way to build the css classes we will be using, it will check to see // if the method is index, and if the url requested didnt include an index then it will add it // this is a feeble way to do this, and needs to be looked into as there are cases where it will break // @todo test with edge cases, fix for edge cases. $this->css_classes = Router::$rsegments; if (Router::$method == 'index' && !in_array('index', Router::$rsegments)) { $this->css_classes[] = 'index'; } }
/** * Will delete an inspiration, if the inspiration is owned by the current user * * * @todo: do not allow inspirations to be deleted if they are published. * @param unknown_type $id */ public function delete($id = NULL) { if ($this->access->allowed('inspirations', 'delete')) { if ($id) { $inspiration = ORM::factory('inspiration', $id); if ($inspiration->loaded) { // make sure that the current user is the owner of the inspiration. if ($inspiration->user_id == $this->current->id) { if ($inspiration->status != 'approved') { $inspiration->status = 'deleted'; if ($inspiration->save()) { $this->notification->add($this->i18n['system.inspiration.success'], $inspiration->name); } else { $this->notification->add($this->i18n['system.inspiration.failed'], $inspiration->name); } } else { $this->notification->add($this->i18n['system.inspiration.approved'], $inspiration->name); } } else { $this->notification($this->i18n['system.access.failed']); // error you do not have access to delete someone elses inspiration. } } else { $this->notification($this->i18n['system.inspiration.invalid']); } } else { $this->notification($this->i18n['system.inspiration.invalid']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
echo url::area() . 'edit/' . $content->id; ?> "><?php echo $content->name; ?> </a></td> <td class="align-center"><?php echo $content->status == 'approved' ? '<span class="icon-approved">✔</span>' : '<span class="icon-pending">✘</span>'; ?> </td> <td><a class="text-edit" href="<?php echo url::area() . 'edit/' . $content->id; ?> ">Edit</a> <a class="text-delete" href="<?php echo url::area() . 'delete/' . $content->id; ?> " onclick="return confirm('Do you really want to delete?');">Delete</a></td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="3">There are currently no technicals for this paper, to add one please click on the 'Add Technical' button.</td></tr> <?php } ?> </tbody> </table>
<div class="header"> <h2>Your Spicers</h2> </div><!-- /.header --> <?php if (isset($breadcrumbs) && $breadcrumbs != NULL) { ?> <?php echo $breadcrumbs; ?> <?php } ?> <form id="signin-form" action="<?php echo url::area() . 'signin'; ?> " method="post" class="column x16"> <div class="notifications"></div> <fieldset class="column x8 first"> <input type="hidden" name="redirect" value="<?php echo $redirect; ?> " /> <div class="column x4"> <div class="header page-title">
/** * Note this does not actually delete the faq but rather it just changes the status of it. */ public function delete($id = FALSE) { $group = ''; // assign the group, so if somethign goes wrong we wont get a url redirect error if ($this->access->allowed('faqs', 'delete')) { if ($id) { $faq = ORM::factory('faq')->find($id); if ($faq->loaded) { $faq->status = 'deleted'; if ($faq->save()) { $this->notification->add($this->i18n['system.faq.success'], $faq->name); } else { $this->notification($this->i18n['system.faq.error']); } // redirect ot the group page if we have one. if (!request::is_ajax()) { url::redirect(url::area() . 'index/' . $faq->group); } } else { $this->notification($this->i18n['system.faq.invalid']); } } else { $this->notification($this->i18n['system.faq.invalid']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
public function delete($id = FALSE) { if ($this->access->allowed('campaigns', 'delete')) { if ($id) { $campaign = ORM::factory('campaign')->find($id); if ($campaign->loaded) { $campaign->status = 'deleted'; if ($campaign->save()) { $this->notification->add($this->i18n['system.campaign.success'], $campaign->name); } else { $this->notification($this->i18n['system.campaign.error']); } } else { $this->notification($this->i18n['system.campaign.invalid']); } } else { $this->notification($this->i18n['system.campaign.invalid']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
public function reset_process() { // Validate the form input $input = Validation::factory($this->input->post())->pre_filter('trim')->add_rules('email', 'required', 'length[4,127]'); if ($input->validate()) { $user = ORM::factory('user')->where('email', $this->input->post('email'))->find(); if (valid::email($this->input->post('email'))) { if ($user->loaded) { // we have found the user and their email address. // @todo make email useable, view, conifg options etc. $password = text::random(Kohana::config('password_reset.password_character_type'), Kohana::config('password_reset.random_password_length')); $user->password = $password; if ($user->save()) { // @todo change this. So very bad. email::send($this->input->post('email'), '*****@*****.**', 'Password Reset', 'As requested, your password has been reset. It is now : ' . $password, TRUE); $this->notification->add()->type('success')->title('Password Reset')->description('Your new password has been emailed to you.'); } else { $this->notification->add()->type('error')->title('System Error')->description('The System was unable to set the new password.'); } } else { $this->notification->add()->type('error')->title('Invalid Email')->description('No such email address is with in our system.'); } } else { $this->notification->add()->type('error')->title('Invalid Email')->description('You must enter a <u>valid</u> email address to recover your password.'); } url::redirect(url::area() . 'login'); } else { $this->notification->add()->type('error')->title('No Email Entered')->description('You must enter a valid email address to recover your password.'); } }
/** * This method will do the update processs upon the location, this needs to be mopved into the frmaework * @todo to be moved intot he framework, of the hive feramw work */ public function update() { if ($this->access->allowed('locations', 'update')) { $location = orm::factory('location')->find($this->input->post('id')); if ($location->loaded) { $input = Validation::factory($this->input->post())->pre_filter('trim')->add_rules('name', 'required')->add_rules('status', 'required')->add_rules('group', 'required')->add_rules('latitude', 'required')->add_rules('longitude', 'required')->add_rules('address', 'required'); if ($input->validate()) { // make sure that name of the location has not been entered with the same name as an exsiting one if ($this->input->post('name') != $location->name) { $existing = orm::factory('location')->where('name', $this->input->post('name'))->where('group', $this->input->post('group'))->find(); if ($existing->loaded) { $this->notification->add($this->i18n['system.location.exists'], array($this->input->post('name'), $this->input->post('group'))); url::redirect(url::area() . 'edit/' . $location->name); // redirect back to the edit page } } $location->name = $this->input->post('name'); $location->description = $this->input->post('description'); $location->url = $this->input->post('url'); $location->address = $this->input->post('address'); $location->latitude = $this->input->post('latitude'); $location->longitude = $this->input->post('longitude'); $location->status = $this->input->post('status'); $location->group = $this->input->post('group'); // now add the image. if (is_array($this->input->post('images'))) { $images = $this->input->post('images'); $location->image = $images['logo']; } if ($location->save()) { $this->notification->add($this->i18n['system.location.success'], $location->name); // make sure that the file location exists, if not create it $cms = DOCROOT . 'application/' . SITE . '/media/cms/locations/' . $location->id; if (file::tree($cms)) { if (isset($images)) { // add the campaign logo $path = $images['logo']; if (file_exists(DOCROOT . 'upload/' . $path)) { //@todo change this so that the uploads folder is not part of the info sent in if (rename(DOCROOT . 'upload/' . $path, $cms . '/' . $path)) { $this->notification->add($this->i18n['cms.image.success']); } else { $this->notification->add($this->i18n['cms.image.error']); } } else { $this->notification->add($this->i18n['cms.cover.error']); } } } else { $this->notification->add($this->i18n['cms.folder.error']); } url::redirect(url::area() . 'edit/' . $location->id); } else { $this->notification->add($this->i18n['system.location.failed'], $location->name); } } else { foreach ($input->errors() as $key => $value) { $this->notification->add($this->i18n['filter.' . $key . '.' . $value]); } } } else { $this->notification->add($this->i18n['system.location.invalid']); } } else { url::failed(); } url::redirect(url::area() . 'edit/' . $this->input->post('id')); }
public function delete($id = NULL) { if ($this->access->allowed('papers', 'delete')) { if ($id) { $paper = ORM::factory('paper')->find($id); if ($paper->loaded) { $paper_name = $paper->name; $paper->status = 'deleted'; if ($paper->save()) { $this->notification->add($this->i18n['system.paper.success'], $paper_name); } else { $this->notification->add($this->i18n['system.paper.error'], $paper_name); } } else { $this->notification($this->i18n['system.paper.invaild']); } } else { $this->notification($this->i18n['system.paper.invaild']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
echo $breadcrumbs; ?> <?php } ?> <div id="register-intro" class="column x4"> <div class="header page-title"> <h3>Register</h3> <h4>Create an account with Spicers to create and share favourite lists of papers, submit work to the Inspiration showcase, order samples and more.</h4> </div> <p>Have an account? <a href="account/login">Sign in</a></p> </div><!-- /.column --> <form id="site-register" action="<?php echo url::area() . 'signup'; ?> " method="post" class="column x12"> <div class="notifications"></div> <div id="register"> <fieldset class="column x4 first"> <div class="header"> <h4>Your Details</h4> </div><!-- /.header --> <dl> <dt><label for="register-user-firstname">First Name <span class="required">*</span></label></dt> <dd><input type="text" id="register-user-firstname" name="firstname" value="<?php echo isset($post['firstname']) ? $post['firstname'] : '';
<?php echo $breadcrumbs; ?> <?php } ?> <div class="column x4"> <div class="header page-title"> <h3>Settings</h3> <p>Keep your details up to date to get the best out of Spicers.com.au</p> </div> <form id="account-settings" action="<?php echo url::area() . 'update'; ?> " method="post"> <div class="notifications"></div> <input type="hidden" name="action" value="details" /> <fieldset> <legend>Your Details</legend> <ul class="block-list"> <?php if ($type == 'username') { ?> <li> <label class="column first" for="settings-user">User Name</label> <div class="column x3 last"> <input type="text" name="username" id="settings-user" value="<?php echo $user->username;
<div class="image"> <a href="/products/papers/view/<?php echo $paper->name; ?> "><img src="/media/cms/products/papers/<?php echo $paper->id; ?> /logo.jpg" alt="<?php echo $paper->name; ?> " /></a> <?php if ($current_user) { ?> <a href="<?php echo url::area() . 'papers/delete/' . $lightbox->id . '/' . $paper->id; ?> " class="button button-account remove"><span>Remove</span></a> <?php } ?> </div> <div class="content"> <h5><a href="/products/papers/view/<?php echo $paper->name; ?> "><?php echo $paper->name; ?> </a></h5> <p><?php
/** * Note this does not actually delete the faq but rather it just changes the status of it. */ public function delete($id = FALSE) { $group = ''; // assign the group, so if somethign goes wrong we wont get a url redirect error if ($this->access->allowed('glossaries', 'delete')) { if ($id) { $glossary = ORM::factory('glossary')->find($id); if ($glossary->loaded) { $glossary->status = 'deleted'; if ($glossary->save()) { $this->notification->add($this->i18n['system.glossary.success'], $glossary->name); } else { $this->notification($this->i18n['system.glossary.error']); } } else { $this->notification($this->i18n['system.glossary.invalid']); } } else { $this->notification($this->i18n['system.glossary.invalid']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
public function delete($id = NULL) { if ($this->access->allowed('industrials', 'delete')) { if ($id > 0) { $industrial = orm::factory('industrial')->find($id); if ($industrial->loaded) { $name = $industrial->name; // for use with the notification system if ($industrial->delete()) { // success } else { // error } } else { // invalid } } else { // invalid } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
public function signout() { Security::instance()->logout(); $this->notification->add($this->i18n['system.signout.success']); url::redirect(url::area() . 'login'); }
/** * The method used to delete a object, redirects to index * * @param integer $id the id of the object to delete */ public function delete($id = NULL) { // make sure that they are only trying to delete their own lightboxes if ($this->access->allowed('lightboxes', 'delete')) { $current = Security::instance()->get_user(); if ($id) { $lightbox = ORM::factory('lightbox')->find($id); if ($lightbox->loaded) { if ($lightbox->creator_id == $current->id) { $lightbox_name = $lightbox->name; if ($lightbox->delete()) { $this->notification->add($this->i18n['system.lightbox.success'], $lightbox_name); } else { $this->notification->add($this->i18n['system.lightbox.error'], $lightbox_name); } } else { $this->notification->add($this->i18n['system.user.invalid']); } } else { $this->notification->add($this->i18n['system.lightbox.invalid']); } } else { $this->notification->add($this->i18n['system.lightbox.invalid']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
public function delete($id = NULL) { if ($this->access->allowed('billboards', 'delete')) { if ($id != NULL) { $billboard = orm::factory('billboard', $id); if ($billboard->loaded) { $billboard->status = 'deleted'; $name = $billboard->name; if ($billboard->save()) { $this->notification->add($this->i18n['system.billboard.success'], $name); } else { $this->notification->add($this->i18n['system.billboard.error'], $name); } } else { $this->notification->add($this->i18n['system.billboard.invlaid']); } } else { $this->notification->add($this->i18['system.billboard.invalid']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::area()); } }
<div class="column x4"> <div class="header page-title"> <h3>Your Inspirations</h3> <p>Upload your work to get it listed in the <a href="inspirations">Inspiration</a> section of our website.</p> </div> <div id="inspiration-index"> <div class="header"> <h4><?php echo isset($inspirations) ? count($inspirations) : 0; ?> Projects</h4> <a href="<?php echo url::area() . 'add'; ?> " id="inspiration-add-project" class="button button-account"><span>Add Project</span></a> </div><!-- /.header --> <?php if (isset($pagination)) { ?> <ul class="toolbar pagination"> <!-- #deprecated --> <!-- <li class="first"><?php echo $page_number; ?> </li> --> <!-- /#deprecated --> <?php