/** * * Contruct that checks you are loged in before nothing else happens! */ function __construct(Request $request, Response $response) { if (Theme::get('premium') != 1) { Alert::set(Alert::INFO, __('Upgrade your Open Classifieds site to activate this feature.')); } parent::__construct($request, $response); }
function __construct(Request $request, Response $response) { parent::__construct($request, $response); //forcing a filter if (Core::request('filter__id_forum') === NULL) { $this->_filter_post['id_forum'] = 'NOT NULL'; } }
function __construct(Request $request, Response $response) { if (Theme::get('premium') != 1) { Alert::set(Alert::INFO, __('Upgrade your Yclas site to activate this feature.')); } $this->_filter_fields = array('id_user' => 'INPUT', 'expire_date' => 'DATE', 'created' => 'DATE', 'id_plan' => array('type' => 'SELECT', 'table' => 'plans', 'key' => 'id_plan', 'value' => 'seoname'), 'status' => array(0 => 'Inactive', 1 => 'Active')); parent::__construct($request, $response); }
public function action_delete() { if ($this->request->param('id') == $this->user->id_user) { Alert::set(Alert::INFO, __('You can not delete your user')); HTTP::redirect(Route::url('oc-panel', array('controller' => $this->request->controller()))); } else { return parent::action_delete(); } }
function __construct(Request $request, Response $response) { $this->_filter_fields = array('id_user' => 'INPUT', 'pay_date' => 'DATE', 'created' => 'DATE', 'paymethod' => array('type' => 'DISTINCT', 'table' => 'orders', 'field' => 'paymethod'), 'id_product' => Model_Order::products(), 'status' => Model_Order::$statuses); parent::__construct($request, $response); $this->_buttons_actions = array(array('url' => Route::url('oc-panel', array('controller' => 'order', 'action' => 'pay')) . '/', 'title' => __('Mark as paid'), 'class' => '', 'icon' => 'fa fa-fw fa-usd'), array('url' => Route::url('oc-panel', array('controller' => 'profile', 'action' => 'order')) . '/', 'title' => __('See order'), 'class' => '', 'icon' => 'fa fa-fw fa-search')); }
function __construct(Request $request, Response $response) { parent::__construct($request, $response); $this->_buttons_actions = array(array('url' => Route::url('oc-panel', array('controller' => 'user')) . '?filter__id_role=', 'title' => 'users', 'class' => 'btn btn-xs btn-default', 'icon' => 'fa fa-users')); }
function __construct(Request $request, Response $response) { parent::__construct($request, $response); $this->_buttons_actions = array(array('url' => Route::url('oc-panel', array('controller' => 'profile', 'action' => 'order')) . '/', 'title' => 'see order', 'class' => 'btn btn-xs btn-success', 'icon' => 'glyphicon glyphicon-search')); }
/** * * Loads a basic list info * @param string $view template to render */ public function action_export($view = NULL) { if (class_exists('Model_Ad')) { //the name of the file that user will download $file_name = $this->_orm_model . '_export.csv'; //name of the TMP file $output_file = tempnam('/tmp', $file_name); //instance of the crud $users = ORM::Factory($this->_orm_model); //writting $output = fopen($output_file, 'w'); //header of the csv $header = array('id_user', 'name', 'seoname', 'email', 'description', 'num_ads', 'image', 'last_login', 'last_modified', 'created', 'ipaddress', 'status'); foreach (Model_UserField::get_all(FALSE) as $key => $value) { $header[] = $key; } //header of the CSV fputcsv($output, $header); //getting all the users $users = $users->find_all(); //each element foreach ($users as $user) { fputcsv($output, array('id_user' => $user->id_user, 'name' => $user->name, 'seoname' => $user->seoname, 'email' => $user->email, 'description' => $user->description, 'num_ads' => $user->ads->count_all(), 'image' => $user->get_profile_image(), 'last_login' => $user->last_login, 'last_modified' => $user->last_modified, 'created' => $user->created, 'ipaddress' => long2ip($user->last_ip), 'status' => $user->status) + $user->custom_columns(FALSE, FALSE)); } fclose($output); //returns the file to the browser as attachement and deletes the TMP file Response::factory()->send_file($output_file, $file_name, array('delete' => TRUE)); } else { return parent::export(); } }