private function _setAdminUser() { $ci =& get_instance(); AZ::model('user'); $user = array('name' => 'AZinkey', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => $ci->user->hash_password('123456'), 'status' => 1, 'gid' => 1); $ci->db->insert('users', $user); if (!$ci->db->insert_id()) { return FALSE; } $adminProfile = array('user_id' => $ci->db->insert_id(), 'avatar' => 'media/users/az.jpg', 'address' => 'Roop Mahal, Prem gali, Kholi no. 420', 'city' => 'Excuse Me', 'state' => 'Please', 'country' => 'India', 'phone' => '9876543210'); return $ci->db->insert('user_profiles', $adminProfile); }
function initialize() { $ci =& get_instance(); $uri =& load_class('URI', 'core'); $admin = $uri->segment(1); $is_admin = $admin == 'administrator' || $admin == 'admin' ? true : false; $language = $is_admin ? admin_language() : site_language(); $side = $is_admin ? 'app' : 'site'; $user_lang_request = trim($ci->input->get('lang')); $user_lang = $ci->session->userdata('user_lang'); if (!empty($user_lang_request)) { $ci->session->set_userdata('user_lang', $user_lang_request); AZ::redirect(current_url()); } if (isset($user_lang) && !empty($user_lang) && !$is_admin) { $ci->lang->load($side, $user_lang); } else { $ci->lang->load($side, $language); } }
public function track() { if (!$this->session->userdata('visited') && $_SERVER['REMOTE_ADDR'] != '::1') { AZ::helper('date'); $this->load->library('user_agent'); $visitData = array('ip' => $_SERVER['REMOTE_ADDR'], 'is_mobile' => $this->agent->is_mobile(), 'platform' => $this->agent->platform(), 'is_browser' => $this->agent->is_browser(), 'browser' => $this->agent->browser(), 'browser_version' => $this->agent->version(), 'device' => $this->agent->mobile(), 'refer' => $this->agent->referrer(), 'page' => $this->uri->uri_string(), 'logged' => user::id()); $this->session->set_userdata('visited', 1); return $this->db->insert('visitors', $visitData); } }
/** * Remove Menu Item * * @param integer $item_id * @return redirect */ public function remove_item($item_id) { if ($this->db->delete('menu_items', array('id' => (int) $item_id))) { AZ::redirectSuccess('admin/menus', lang('Removed')); } else { AZ::redirectError('admin/menus', lang('Error occured')); } }
<span class="glyphicon pull-left hidden-xs"></span> <?php __('Publish'); ?> </a> </h4> </div> <div id="fieldset_publish" class="panel-collapse collapse in"> <br /> <div class="row-fluid"> <div class="col-md-12"> <div class="field-row form-light"> <div class="col-xs-12"> <span class="glyphicon glyphicon-link"></span> <?php echo form_label(AZ::setting('site_url'), 'alias'); echo form_input(array('name' => 'alias', 'placeholder' => isset($contentType->name) ? rtrim($contentType->name, 's') . '-ID' : '', 'value' => isset($content->alias) ? $content->alias : '')); ?> </div> <div class="clearfix"></div> </div> <div class="field-row"> <div class="col-xs-5"> <i class="fa fa-check-square-o"></i> <?php echo form_label(lang('Status'), 'status'); ?> </div> <div class="col-xs-7">
_u('admin/settings'); ?> " class="btn btn-default btn-sm"> <i class="fa fa-arrow-circle-left"></i> </a> <button type="button" class="btn btn-primary btn-sm click-submit" data-form="#saveSection"> <i class="fa fa-save"></i> </button> </div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> <?php AZ::block('system-message'); ?> <div class="row-fluid"> <?php echo form_open('admin/settings/save_section', array('id' => 'saveSection')); ?> <div class="panel panel-default"> <div class="panel-body"> <div class="field-row"> <?php echo form_label(lang('Title'), 'title'); echo form_input(array('class' => 'form-control', 'name' => 'title', 'value' => isset($section->title) ? $section->title : '')); ?> </div> <div class="field-row">
/** * Flush user session & logged out from application * * @return Redirect */ public function logout() { user::flush(); AZ::redirectSuccess('account'); }
function menu($name = 'Primary', $wrapper_class = 'nav navbar-nav navbar-left') { AZ::model('menu'); AZ::helper('html'); $CI =& get_instance(); $items = $CI->menu->getItemsByName($name, $wrapper_class); return $items; }
/** * Load Activities for Dashboard * * @return Object (JSON ) */ public function load_activity_json() { AZ::helper('date'); $offset = $this->input->post('offset'); $activities = $this->message->getActivities('*', array(), $offset, 5); $posts = array(); if (count($activities)) { $i = 0; foreach ($activities as $activity) { $posts[$i] = new stdClass(); $posts[$i]->subject = $activity->subject; $posts[$i]->body = $activity->body; $posts[$i]->created = date_when(human_to_unix($activity->created)); $i++; } } echo json_encode($posts); }
echo form_close(); ?> </div> </div> <div class="clearfix"></div> </div> <?php AZ::block('system-message'); ?> <div class="row-fluid"> <div class="col-md-8"> <?php AZ::block('dashboard/widgets'); ?> <?php AZ::block('dashboard/visits-chart'); ?> </div> <div class="col-md-4"> <?php AZ::block('dashboard/recent-activity'); ?> </div> </div> </div> </section>
/** * Remove Field and Redirect Back to Fields * * @param integer $id * @param integer $fieldset * @return redirect */ public function remove_field($id, $fieldset = 1) { if ($this->db->delete('content_fields', array('id' => (int) $id))) { AZ::redirectSuccess('admin/contents/fields/' . $fieldset, lang('Removed')); } else { AZ::redirectError('admin/contents/fields/' . $fieldset, lang('Error occured')); } }
/** * Update Permissions * * @return Redirect */ public function permissions_reset() { if (user::access_id() != 1) { AZ::redirectError('admin/dashboard', lang('Unauthorized Access')); } $post = $this->input->post(); if (empty($post)) { AZ::redirectError('admin/users/permissions', lang('no_option')); return FALSE; } if (!$this->user->resetPermissions($post)) { AZ::redirectError('admin/users/permissions', lang('Error occured')); } else { AZ::redirectSuccess('admin/users/permissions', lang('Saved')); } }
/** * Group Category Page By Alias * * Primary View is views/front/blocks/content/page * * @param string $alias */ public function search($keyword, $offset = 0) { $total_contents = $this->content->getContentsByWords($keyword, 0, 0, true); $pagination = AZ::pagination('search?words=' . $keyword, 2, 5, $total_contents, true, true); $contents = $this->content->getContentsByWords($keyword, $offset, 5); $varriables = array('block' => 'content/search', 'contents' => $contents, 'total_contents' => $total_contents, 'pagination' => $pagination); if (isset($group->name)) { $varriables['page_title'] = 'Search Result for ' . $keyword; } AZ::layout('content-right', $varriables); //$this->content->track(); // uncomment for enabled self tracking into Visitors }
public function getMessagesData($mode = 'inbox', $message_id = 0, $offset = 0) { switch ($mode) { case 'inbox': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.receiver' => user::id()), $offset, $limit); break; case 'stared': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.is_star' => 1, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.is_star' => 1, 'messages.receiver' => user::id()), $offset, $limit); break; case 'outbox': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.author' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.author' => user::id()), $offset, $limit); break; case 'trash': $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 1, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 1, 'messages.receiver' => user::id()), $offset, $limit); break; default: $limit = AZ::setting('record_per_page'); $total_message = $this->getMessages('*', array('messages.trash' => 0, 'messages.receiver' => user::id()), 0, 0, true); $pagination = AZ::pagination('admin/dashboard/messages/' . $mode . '/' . $message_id, 6, $limit, $total_message); $messages = $this->getMessages('users.name,messages.id,messages.label,messages.is_read,messages.is_star,messages.subject,messages.body,messages.created,messages.author,messages.have_attachment', array('messages.trash' => 0, 'messages.receiver' => user::id()), $offset, $limit); break; } $messagesData = array('total_message' => $total_message, 'pagination' => $pagination, 'messages' => $messages); return $messagesData; }
</div> </div> <div class="clearfix"></div> </div> <?php } else { ?> <?php __('no_record'); ?> <?php } ?> </div> </div> </section> <?php if (count($groups) > AZ::setting('record_per_page')) { ?> <script> (function($) { $(document).ready(function(){ $("#groupsTable").DataTable(); }); })(jQuery); </script> <?php }
<?php AZ::block($block);
<?php echo AZ::showFlashError(); echo AZ::showFlashWarning(); echo AZ::showFlashSuccess(); echo AZ::showFlashMSG();
<a href="<?php echo site_url(); ?> " title="<?php __(AZ::setting('site_name')); ?> " id="siteHome" target="_blank"> <i class="fa fa-home"></i> </a> </li> </ul> <?php AZ::block('header/user-navigation'); ?> </div> </nav> </header> <div id="wrapper"> <div id="canvas"> <?php AZ::block('navigations'); ?>
/** * Flush user session & logged out from application * * @return Redirect */ public function logout() { user::flush(); AZ::redirectSuccess('administrator'); }
/** * Remove Setting * * @param integer $setting_id * @return redirect */ public function remove_setting($setting_id) { if ($this->db->delete('settings', array('id' => (int) $setting_id))) { AZ::redirectSuccess('admin/settings', lang('Removed')); } else { AZ::redirectError('admin/settings', lang('Error occured')); } }
AZ::block('account/profile-menu'); ?> </div> <div class="col-xs-2 pull-right"> <ul class="language-switcher navbar-right"> <a href="javascript:void(0);" class="dropdown-toggle text-center" data-toggle="dropdown"> <span class="glyphicon glyphicon-globe"></span> <small class="hidden-xs"><?php __(language_name()); ?> </small> <b class="caret"></b></a> <ul class="dropdown-menu dropdown-menu-right "> <?php echo language_flags(); ?> </ul> </ul> </div> </div> </div> </div> <?php AZ::block('header/carousel'); ?> </div>
public static function redirectUnauthorizedAccess($uri = 'administrator', $flashValue = 'Unauthorized Access', $loggedout = false) { if (!self::access()) { if ($loggedout) { self::flush(); } AZ::redirectError($uri, $flashValue); } }
<?php AZ::head(); ?> <div class="container-fluid login-wrapper"> <?php AZ::block(isset($block) ? $block : 'default'); ?> </div>
<?php AZ::header(); AZ::block($block); AZ::footer();
<?php if (isset($styles)) { load_styles($styles); } ?> <script src="<?php echo skin_url(); ?> scripts/jquery-1.11.3.min.js" type="text/javascript"></script> <script src="<?php echo skin_url(); ?> scripts/bootstrap.min.js" type="text/javascript"></script> <?php if (isset($scripts)) { echo load_scripts($scripts); } ?> <title> <?php echo page_title(isset($page_title) ? $page_title : AZ::setting('global_meta_title')); ?> </title> </head> <body class="<?php echo page_class(); ?> ">
<?php AZ::block('account/sidebar-menu');