Beispiel #1
0
 protected static function render_menu($menus)
 {
     $selected = \Uri::segment(1);
     $out = '';
     foreach ($menus as $k => $v) {
         is_int($k) and $k = $v;
         if (substr_compare($k, 'divider', 0, 7) == 0) {
             $out .= static::$template['menu_divider'];
             continue;
         }
         isset($v['label']) or $v['label'] = \Lang::get($k);
         isset($v['link']) or $v['link'] = '#';
         isset($v['level']) or $v['level'] = 0;
         $user = \Session::get('user_info');
         if ($user['level'] < $v['level']) {
             continue;
         }
         if (isset($v['submenu']) and count($v['submenu']) > 0) {
             $active = array_key_exists($selected, $v['submenu']) ? ' active' : '';
             $out .= str_replace(array('{item_id}', '{active}', '{label}', '{submenu}'), array($k, $active, $v['label'], static::render_menu($v['submenu'])), static::$template['menu_dropdown']);
         } else {
             $active = $selected == $k ? ' class="active"' : '';
             $out .= str_replace(array('{item_id}', '{active}', '{link}', '{label}'), array($k, $active, \Uri::base() . $v['link'], $v['label']), static::$template['menu_item']);
         }
     }
     return $out;
 }
Beispiel #2
0
 public function before()
 {
     parent::before();
     $this->app = \Uri::segment(1);
     // guess app_name, if it is not provided
     if (is_null($this->app_name)) {
         $this->app_name = \Inflector::classify($this->app);
     }
     // guess model name from URI segment, if it is not provided
     if (is_null($this->model)) {
         $this->model = 'Model_' . $this->app_name;
     }
     // set app title
     $this->template->title = static::$title;
     // render menus
     $this->template->set('menu', Petro_Menu::render(static::$menu), false);
     // use uri segment to find ref_type from defined menu for later use
     $menu = Petro_Menu::find($this->app, static::$menu);
     // if page_title is not set, default to menu label
     if (!isset($this->template->page_title)) {
         $this->template->page_title = empty($menu['label']) ? \Inflector::pluralize($this->app_name) : $menu['label'];
     }
     $this->sidebars = new Petro_Sidebar();
     is_null($this->must_login) and $this->must_login = \Config::get('petro.auth.enable', true);
     // if require login and not in the ignore login list, then check for login
     if ($this->must_login and !in_array(\Uri::string(), static::$ignore_login)) {
         if (!\Auth::instance()->check()) {
             $this->login_then_redirect(\Uri::string());
         }
     }
 }
Beispiel #3
0
 /**
  * 允许没有openid下的访问列表
  *
  * @return array
  */
 protected function getNotOpenidAllowed()
 {
     $allowed = [['module' => 'order', 'controller' => 'home', 'actions' => ['save_wxpay_qrcode']]];
     foreach ($allowed as $item) {
         if ($item['module'] == \Uri::segment(1) && in_array(\Uri::segment(2), $item['actions'])) {
             return true;
         } else {
             if ($item['module'] == \Uri::segment(1) && $item['controller'] == \Uri::segment(2) && in_array(\Uri::segment(3), $item['actions'])) {
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #4
0
 /**
  * 获取未登录时的可访问列表
  * @return bool
  */
 protected function getNotLoginAllowed()
 {
     $allowed = [['module' => 'ucenter', 'controller' => 'home', 'actions' => ['register', 'login', 'forget_pwd']]];
     foreach ($allowed as $item) {
         if ($item['module'] == \Uri::segment(1) && in_array(\Uri::segment(2), $item['actions'])) {
             return true;
         } else {
             if ($item['module'] == \Uri::segment(1) && $item['controller'] == \Uri::segment(2) && in_array(\Uri::segment(3), $item['actions'])) {
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #5
0
 /**
  * Define columns
  */
 protected static function _columns($page = 'index')
 {
     $columns_for = array('view' => array('id' => array('required' => true), 'mk_no' => array('required' => true), 'mk_date' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro::to_app_date($data->mk_date);
     })), 'client_id' => array('required' => true), 'client_po', 'delivery_date' => array('grid' => array('process' => function ($data) {
         return Petro::to_app_date($data['delivery_date']);
     })), 'deliver_to', 'product_type' => array('grid' => array('process' => function ($data) {
         return Petro_Lookup::get('product.type', $data->product_type);
     })), 'belt_type' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.type', $data['belt_type']);
     })), 'belt_color' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.color', $data['belt_color']);
     })), 'belt_width' => array('required' => true, 'grid' => array('process' => function ($data) {
         return $data->belt_width . ' ' . Petro_Lookup::get('belt.w.unit', $data->belt_width_unit);
     })), 'belt_width_unit' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.w.unit', $data['belt_width_unit']);
     })), 'belt_ply' => array('required' => true), 'belt_ep' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.ep', $data['belt_ep']);
     })), 'belt_grade' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.grade', $data['belt_grade']);
     })), 'belt_top_grade', 'belt_bot_grade', 'belt_thick' => array('required' => true), 'belt_top_thick' => array('required' => true), 'belt_bot_thick' => array('required' => true), 'belt_length' => array('required' => true), 'belt_length_unit' => array('required' => true), 'belt_end' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.end', $data['belt_end']);
     })), 'belt_qty' => array('required' => true), 'belt_price', 'belt_disc1' => array('label' => 'Discount1'), 'belt_disc2' => array('label' => 'Discount2'), 'belt_disc3' => array('label' => 'Discount3'), 'belt_price_net', 'belt_amount', 'remark', 'creator_id', 'creator_name', 'status'), 'index' => array('id' => array('visible' => false), 'mk_no' => array('label' => __('mk_no'), 'grid' => array('sortable' => true, 'process' => function ($data) {
         return '<a href="' . Uri::base() . Uri::segment(1) . '/view/' . $data->id . '">' . $data->mk_no . '</a>';
     })), 'mk_date' => array('label' => __('mk_date'), 'grid' => array('format' => 'date', 'sortable' => true)), 'client_id' => array('label' => __('client_id'), 'grid' => array('sortable' => true, 'process' => function ($data) {
         return Petro_Lookup::table('clients', 'id', 'code', $data->client_id);
     })), 'belt_info' => array('label' => __('belt_info'), 'grid' => array('process' => function ($data) {
         return BeltInfo::short($data);
     })), 'belt_qty' => array('label' => __('belt_qty'), 'grid' => array('align' => 'right', 'process' => function ($data) {
         return $data->belt_qty . '&nbsp;' . __('belt_piece');
     })), 'belt_price_net' => array('label' => __('belt_price_net'), 'grid' => array('align' => 'right', 'format' => 'number')), 'belt_amount' => array('label' => __('belt_amount'), 'grid' => array('align' => 'right', 'format' => 'number')), 'status' => array('label' => __('status'), 'grid' => array('process' => function ($data) {
         $t = '';
         switch ($data->status) {
             case 0:
                 $t = 'warning';
                 break;
             case 1:
                 $t = 'success';
                 break;
             case 2:
                 $t = '';
                 break;
             default:
                 $t = 'important';
         }
         return '<span class="label ' . $t . '">' . Petro_Lookup::get('prd.status', $data->status) . '</span>';
     })), '_action_' => Petro_Grid::default_actions()));
     return $columns_for[$page];
 }
Beispiel #6
0
 private static function _data($sql = false)
 {
     if (!$sql || DB::$DB->cache == false) {
         return false;
     }
     // if this function has already been called return data from variable.
     if (count(self::$_data) > 0) {
         return self::$_data;
     }
     // the requested URI will become the cache sub-folder and
     // a MD5 hash of the SQL will be the filename
     $data['sone'] = !Uri::segment(1) ? 'default' : Uri::segment(1);
     $data['stwo'] = !Uri::segment(2) ? 'index' : Uri::segment(2);
     $data['path'] = DB::$DB->cachedir . $data['sone'] . '+' . $data['stwo'] . '/';
     $data['file'] = md5($sql);
     return $data;
 }
Beispiel #7
0
 /**
  * Returns currently active language.
  *
  * @return   string    currently active language
  */
 public static function get_lang()
 {
     $language = \Config::get('language');
     if ($language == self::$default_language) {
         $lang_segment = \Uri::segment(1);
         if (!empty($lang_segment) and $lang_segment != false) {
             $languages = \Config::get('languages');
             if (!empty($languages) and array_search($lang_segment, $languages) !== false) {
                 $language = $lang_segment;
             }
         }
     }
     if (empty($language)) {
         $language = self::$fallback[0];
     }
     return $language;
 }
Beispiel #8
0
 /**
  * Constructor
  *
  * @param Exception Exception to be parsed for Amon
  *
  * @return null
  */
 public function __construct(\Exception $exception)
 {
     $this->exception = $exception;
     $trace = $this->exception->getTrace();
     foreach ($trace as $t) {
         if (!isset($t['file'])) {
             continue;
         }
         $this->backtrace[] = "{$t['file']}:{$t['line']}:in `{$t['function']}\\'";
     }
     // exception data
     $message = $this->exception->getMessage();
     // spoof 404 error
     $error_class = get_class($this->exception);
     if ($error_class == 'Http404Error') {
         $error_class = 'ActionController::UnknownAction';
     }
     $data['exception_class'] = $error_class;
     $data['message'] = $message;
     $data['backtrace'] = $this->backtrace;
     if (isset($_SERVER['HTTP_HOST'])) {
         // request data
         $session = isset($_SESSION) ? $_SESSION : array();
         // sanitize headers
         $headers = $this->getallheaders();
         if (isset($headers['Cookie'])) {
             $sessionKey = preg_quote(ini_get('session.name'), '/');
             $headers['Cookie'] = preg_replace("/{$sessionKey}=\\S+/", "{$sessionKey}=[FILTERED]", $headers['Cookie']);
         }
         $server = $_SERVER;
         $keys = array('HTTPS', 'HTTP_HOST', 'REQUEST_URI', 'REQUEST_METHOD', 'REMOTE_ADDR');
         $this->fill_keys($server, $keys);
         $protocol = $server['HTTPS'] && $server['HTTPS'] != 'off' ? 'https://' : 'http://';
         $url = $server['HTTP_HOST'] ? "{$protocol}{$server['HTTP_HOST']}{$server['REQUEST_URI']}" : "";
         $data['data']['request'] = array('url' => $url, 'request_method' => strtolower($server['REQUEST_METHOD']), 'session' => $session);
         $data['request']['controller'] = \Uri::segment(1);
         $data['request']['action'] = \Uri::segment(2);
         $params = array_merge($_GET, $_POST);
         if (!empty($params)) {
             $data['request']['parameters'] = $params;
         }
     }
     $this->data = (array) $data;
 }
 function __toString()
 {
     $modval = "";
     $uri = new Uri();
     $seg = $uri->segment('mod');
     if ($this->ModelDefault != NULL and $seg == '') {
         $seg = $this->ModelDefault;
     }
     if ($seg != '') {
         $lload = "fpp_{$seg}_Model";
         $libload = new $lload();
         $libload->set_property('edit', 1);
         $libload->set_property('delete', 1);
         $libload->set_property('add', 1);
         $modval = $libload->autoblock();
     }
     $str = '';
     if (@$_GET['AJAX_NO_LOAD'] == 'TRUE') {
         return $modval;
     }
     foreach ($this->block as $HeadModule => $Module) {
         $str .= "<div id='admingen_{$HeadModule}' class='HeadModule HM_{$HeadModule}'>\n      <div class='HeadTextModule'>{$HeadModule}</div></div>\n      \n<div class='BodyModule BM_{$HeadModule}'>";
         foreach ($Module as $valuemod) {
             $module_selected = null;
             $style = null;
             if ($valuemod == $seg) {
                 $module_selected = "MNSelected";
                 $style = "<style>.BM_{$HeadModule}{ display:block; }</style>";
             }
             //         echo Kohana::debug($this->FastText[$valuemod]);
             $modulename = Router::$controller . '/' . Router::$method . '/mod/' . $valuemod . '/action/pagina/1';
             $textvaluemod = @$this->FastText[$valuemod] == "" ? $valuemod : $this->FastText[$valuemod];
             $modulename = html::anchor($modulename, $textvaluemod, array('class' => 'kfppadmin_list'));
             $str .= "{$style}\n<div class='ModuleName MN_{$valuemod} {$module_selected}'>\n                    {$modulename}\n                </div>";
         }
         $str .= "</div>";
     }
     $indexadmin = "http://" . $_SERVER['SERVER_NAME'] . '/admin';
     $str .= "<div class='FooterModule'>&nbsp;&nbsp;</div>";
     return "<table width='100%' ><tr><td width='20%' id='tdizq'  valign='top' >\n    <div class='contentmenu'>\n    {$str}\n    </div>\n    </td><td id='tdder' valign='top'>\n      <div class='content-box'>\n      <div class='content-box-header'>\n<ul class='content-box-tabs'>\n<li><a href='http://knittingperuboutique.com/web/admin' class='default-tab'>Home</a></li>\n</ul>\n      </div>\n      <div class='content-box-content'>\n        <div id='main-content' >\n          {$modval}\n        </div>\n      </div>\n      </div>\n    </td></tr></table>";
 }
Beispiel #10
0
 /**
  * Display detailed page of Article
  *
  * @param void
  * @access public
  * @author Nguyen Van Hiep
  *
  * @version 1.0
  * @since 1.0
  */
 public function action_view()
 {
     $art_check = Model_Article::get_art_from_slug(Uri::segment(2));
     if (!$art_check) {
         Response::redirect('common/error');
     }
     $uri = explode('-', Uri::string());
     $id = array_pop($uri);
     $art = Model_Article::find($id);
     $cat = Model_Categories::get_cat_from_slug(Uri::segment(1));
     $related_arts = Model_Article::articles_of_cat_limit($cat->id, $this->lang, $id);
     if (!$art) {
         Session::set_flash('error', __('message.art_not_exist'));
         Response::redirect('common/404');
     }
     $art->views = $art->views + 1;
     $art->save();
     if ($cat->display_type == DS_SANPHAM) {
         $this->template = \View::forge('customer/template_sanpham_detail');
         $view = View::forge('customer/article/detail_sp_slide');
     } elseif ($cat->display_type == DS_MONAN) {
         $this->template = \View::forge('customer/template_monan');
         $view = View::forge('customer/article/detail_monan_slide');
     } elseif ($cat->display_type == QUY_TRINH_SX) {
         $view = View::forge('customer/article/detail_quytrinhsx');
     } else {
         $view = View::forge('customer/article/detail');
     }
     $view->art = $art;
     $view->related_arts = $related_arts;
     $view->cat = $cat;
     if (!empty($cat->parent_id)) {
         $view->p_cat = Model_Categories::find($cat->parent_id);
     }
     // data to display menu
     $this->template->cats = Model_Categories::get_cats_home($this->lang);
     $this->template->pepper_arts = Model_Article::pepper_artilces($this->lang);
     $this->template->title = Security::strip_tags($art->title);
     $this->template->content = $view;
 }
Beispiel #11
0
 public function action_index()
 {
     $this->template->title = 'UOS求人システム';
     $data = array();
     $group = new \Model_Mgroups();
     $data['search_group'] = $group->get_type(1);
     $ujob_obj = new \Model_Ujob();
     $data['search_partner'] = $ujob_obj->get_list_partner();
     $where = Input::get('partner_search') != '' ? 'partner_code = "' . Input::get('partner_search') . '"' : '';
     $data['search_ss_list'] = $ujob_obj->get_list_ss($where);
     $data['search_media'] = $ujob_obj->get_list_media();
     $data['start_date'] = \Fuel\Core\Input::get('start_date');
     $data['end_date'] = \Fuel\Core\Input::get('end_date');
     if (Input::get('export', false)) {
         $res = $ujob_obj->get_search_data(true);
         $this->export($res['res']);
     } else {
         $res = $ujob_obj->get_search_data(false);
     }
     $data['res'] = $res;
     \Session::set('url_job_redirect', \Uri::base() . 'job/jobs/index/' . (\Uri::segment(4) ? \Uri::segment(4) : 1) . '?' . http_build_query(\Input::get()));
     $this->template->content = \Fuel\Core\View::forge('jobs/index', $data);
 }
Beispiel #12
0
<?php

echo $docinfo;
echo isset($flow) ? $flow : '';
echo $comments;
?>
<fieldset class="buttons">
	<?php 
echo Html::anchor(Uri::segment(1), 'Back', array('class' => 'button'));
?>
</fieldset>
Beispiel #13
0
    ?>
">
                                <?php 
    echo Html::anchor('admin/category', 'Categories');
    ?>
                            </li>
                            <li class="<?php 
    echo Uri::segment(2) == 'article' ? 'active' : '';
    ?>
">
                                <?php 
    echo Html::anchor('admin/article', 'Articles');
    ?>
                            </li>
                              <li class="<?php 
    echo Uri::segment(2) == 'date' ? 'active' : '';
    ?>
">
                                <?php 
    echo Html::anchor('admin/date', 'Dates');
    ?>
                            </li>

                            <?php 
    /*
     $files = new GlobIterator(APPPATH . 'classes/controller/admin/*.php');
     foreach ($files as $file) {
     $section_segment = $file->getBasename('.php');
     $section_title = Inflector::humanize($section_segment);
     ?>
     <li class="<?php echo Uri::segment(2) == $section_segment ? 'active' : '' ?>">
Beispiel #14
0
 //Add App to Container
 $container['app'] = $app;
 //Initialize Config and add to Container
 $container['config'] = new Config();
 $timer->setTime('Config');
 //Set Error Handler
 set_error_handler(array($app, 'error'), E_ALL | E_STRICT);
 //Load all Configuration files in Config folder
 foreach (glob(__DIR__ . '/config/*.php') as $key => $val) {
     require_once $val;
 }
 $timer->setTime('Config Folder');
 $uri = new Uri();
 $timer->setTime('URI');
 if (!file_exists(__DIR__ . '/config/config.php')) {
     if ($uri->segment(0) != "Installer") {
         header("Location: Installer");
         exit;
     } elseif (file_exists(__DIR__ . '/install.config.php')) {
         require_once __DIR__ . '/install.config.php';
         $timer->setTime('installConfig');
     }
 }
 $timer->setTime('configFile Checked');
 if ($uri->segment(0) == 'Installer') {
     define('INSTALL', true);
 }
 date_default_timezone_set('UTC');
 $timer->setTime('setTimeZone');
 if (!file_exists(__DIR__ . "/config/routes.php") && !defined('INSTALL')) {
     $timer->setTime('Routes doesnt exist');
Beispiel #15
0
					<div class="control-group">
						<label class="control-label" for="password">Password</label>
						<div class="controls">
							<?php 
echo Form::password('password', Input::post('password', ''));
?>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="password2">Confirm Password</label>
						<div class="controls">
							<?php 
echo Form::password('password2', Input::post('password2', ''));
?>
						</div>
					</div>
					<div class="form-actions">
						<button type="submit" class="btn btn-primary">Submit</button>
						<?php 
echo Html::anchor(\Str::lower(\Uri::segment(1)), 'Cancel', array('class' => 'btn'));
?>
					</div>
				<?php 
echo Form::close();
?>
			</div>
		</div>
	</div>
	

Beispiel #16
0
echo $content;
?>
			</div><!-- END pagecontent -->
			<footer>
				<p class="copyright">&copy;2015 www.ameken.com</p>
			</footer>
		</div><!-- sb-site -->
		<div class="nav_list_list sb-slidebar sb-right">
			<ul>
					<?php 
if (Auth::check()) {
    ?>
							<li class="current"><a href="http://www.ameken.com/pt_fuel/public/pt/update/HTML5" class="link">HTML5</a></li>
							<li class="current"><a href="http://www.ameken.com/pt_fuel/public/pt/update/PHP" class="link">PHP</a></li>
						<li class="current"><a href="http://www.ameken.com/pt_fuel/public/pt/add_data/<?php 
    print Uri::segment(3);
    ?>
" class="link">データの追加</a></li>
							<li class="current"><a href="http://www.ameken.com/pt_fuel/public/pt/logout" class="link">ログアウト</a></li>
					<?php 
} else {
    ?>
						<li class="current"><a href="http://www.ameken.com/pt_fuel/public/pt/index/HTML5" class="link">HTML5</a></li>
						<li class="current"><a href="http://www.ameken.com/pt_fuel/public/pt/index/PHP" class="link">PHP</a></li>
						<li class="current"><a href="http://www.ameken.com/pt_fuel/public/pt/login" class="link">ログイン</a></li>
				<?php 
}
?>
			</ul>
			<!-- Your right Slidebar content. -->
		</div>
Beispiel #17
0
 /**
  * Get product data (code, price, attributes, images)
  * 
  * @access  public
  * @param   $product   object
  * @return  
  */
 public static function product_data($product = false, $attributes_json = null, $post_select = false, $attributeid = false)
 {
     if (!$product) {
         return;
     }
     $out['current_attributes'] = null;
     $out['code'] = null;
     $out['images'] = null;
     $out['select'] = null;
     $out['select_name'] = null;
     $out['sx'] = null;
     // select (attribute) order
     $out['retail_price'] = null;
     $out['sale'] = null;
     $out['price'] = 0;
     $out['price_type'] = null;
     $current_attributes = array();
     $select = array();
     $select_name = array();
     $sx = array();
     $options = array();
     if (json_decode($attributes_json) != null) {
         $current_attributes = Model_Attribute::find(array('where' => array('attributes' => $attributes_json, 'product_id' => $product->id, 'active' => 1), 'limit' => 1));
     }
     //get attributes per product
     $prod_attributes = \Product\Model_Attribute::find_by_product_id($product->id);
     $a_attribute_ids = array();
     if ($prod_attributes) {
         foreach ($prod_attributes as $attr_id) {
             array_push($a_attribute_ids, $attr_id->id);
         }
     }
     // NRB-Gem: if current URL is Pricing Group -> Products
     // Get pricing_attribute_price from current Pricing Group
     // Products can belong to multiple Pricing Groups
     $a_groups = \Sentry::user()->groups();
     if ($a_attribute_ids) {
         if (\Sentry::check()) {
             $a_cond = array(array('product_attribute_id', 'in', $a_attribute_ids));
             if (\Uri::segment(2) != 'admin' && \Sentry::user()->groups() && $a_groups[0]) {
                 $a_cond['user_group_id'] = $a_groups[0]['id'];
             }
             if (\Uri::segment(3) == 'group' && \Uri::segment(4) == 'products') {
                 $a_cond['pricing_group_id'] = \Uri::segment(5);
             }
             $product_sale_price = \Product\Model_Attribute_Price::find(array('where' => $a_cond));
         }
     }
     // NRB-Gem: check if logged in user can buy product for discounted rate
     if (\Uri::segment(2) != 'admin' && \Sentry::user()->groups() && !\Sentry::user()->is_admin() && $a_groups[0]) {
         $o_product_group_options = \DB::select_array(array('able_to_buy'))->from('product_group_options')->join('product_to_groups')->on('product_group_options.product_group_id', '=', 'product_to_groups.group_id')->where('product_group_options.user_group_id', $a_groups[0]['id'])->where('able_to_buy', 1)->where('product_to_groups.product_id', $product->id)->execute();
         $a_result = $o_product_group_options->as_array();
         $product_sale_price = $a_result && $a_result[0]['able_to_buy'] ? $product_sale_price : false;
     }
     // Get all product attributes
     $product_attributes = Model_Product::get_product_attributes($product);
     // Product with attributes
     if ($product_attributes) {
         // Set current attribute
         if ($current_attributes && isset($product_attributes[$current_attributes[0]->id])) {
             $current_attributes = $product_attributes[$current_attributes[0]->id];
         } elseif ($post_select && count($post_select) > 1) {
             foreach ($post_select as $sk => $sv) {
                 if (!isset($post_select_pop)) {
                     $post_select_pop = $post_select;
                     array_pop($post_select_pop);
                 }
                 $count = count($post_select_pop);
                 foreach ($product_attributes as $pk => $pv) {
                     $i = 0;
                     $not_exists = array();
                     foreach ($pv as $pkk => $pvv) {
                         if ($i >= $count) {
                             continue;
                         }
                         if (!isset($post_select_pop[$pvv->attribute->id]) || $post_select_pop[$pvv->attribute->id] != $pvv->option->id) {
                             $not_exists[] = true;
                         }
                         $i++;
                     }
                     if (empty($not_exists)) {
                         $current_attributes = $product_attributes[$pk];
                         break 2;
                     }
                 }
                 if (empty($current_attributes) && $count > 1) {
                     array_pop($post_select_pop);
                 }
             }
             if (empty($current_attributes)) {
                 $current_attributes = reset($product_attributes);
             }
         } elseif ($product->default_attributes) {
             $current_attributes = $product_attributes[reset($product->default_attributes)->id];
         } else {
             $current_attributes = reset($product_attributes);
         }
         foreach ($current_attributes as $k => $v) {
             $options[] = $v->option->id;
         }
         foreach ($product_attributes as $k => $v) {
             if (is_array($v)) {
                 foreach ($v as $kk => $vv) {
                     $select_name[$vv->attribute->id] = $vv->attribute->name != '' ? $vv->attribute->name : $vv->attribute->title;
                     $select_tmp[$k][$vv->attribute->id][$vv->option->id] = $vv->option->title;
                     foreach ($options as $option_key => $option_value) {
                         if ($kk == $option_key) {
                             $select[$vv->attribute->id][$vv->option->id] = $vv->option->title;
                             if ($vv->option->id != $option_value) {
                                 continue 3;
                             }
                         }
                     }
                 }
             }
         }
         if ($select) {
             $sx = array_keys($select_name);
         }
         $b_use_original_price = false;
         if (!empty($current_attributes)) {
             $attr_obj = $current_attributes[0]->product_attribute;
             $out['current_attributes'] = $current_attributes;
             $out['code'] = $attr_obj->product_code;
             if (!empty($attr_obj->images)) {
                 $out['images'] = $attr_obj->images;
             }
             $out['select'] = $select;
             $out['select_name'] = $select_name;
             $out['sx'] = $sx;
             $out['stock_quantity'] = $attr_obj->stock_quantity;
             $out['retail_price'] = $attr_obj->retail_price;
             // NRB-Gem: changed condition from: (!empty($product_sale_price) && $product_sale_price[0]->price != 0)
             // fix for attributes with sale price are not displayed
             if (!empty($product_sale_price)) {
                 $out['with_attr'] = array('attribute' => array());
                 foreach ($product_sale_price as $with_attr) {
                     $out['with_attr']['able_discount'][$with_attr->product_attribute_id] = $with_attr->able_discount;
                     if ($out['with_attr']['able_discount'][$with_attr->product_attribute_id]) {
                         $out['with_attr']['discount'][$with_attr->product_attribute_id] = $with_attr->discount;
                         $out['with_attr']['price'][$with_attr->product_attribute_id] = $with_attr->price;
                     }
                     $out['with_attr']['attribute'][$with_attr->product_attribute_id] = '';
                     foreach ($product_attributes as $o_prod_attr) {
                         $a_attr = array();
                         foreach ($o_prod_attr as $o_attr) {
                             if ($with_attr->product_attribute_id == $o_attr->product_attribute->id) {
                                 $a_attr[] = $o_attr->option->title;
                             }
                         }
                         $out['with_attr']['attribute'][$with_attr->product_attribute_id] .= implode(' | ', $a_attr);
                     }
                     // NRB-Gem: do not display inactive attribute
                     if (empty($out['with_attr']['attribute'][$with_attr->product_attribute_id])) {
                         unset($out['with_attr']['attribute'][$with_attr->product_attribute_id]);
                         unset($out['with_attr']['able_discount'][$with_attr->product_attribute_id]);
                         unset($out['with_attr']['discount'][$with_attr->product_attribute_id]);
                         unset($out['with_attr']['price'][$with_attr->product_attribute_id]);
                     }
                 }
                 // NRB-Gem: get default prices
                 foreach ($prod_attributes as $attr) {
                     if (isset($out['with_attr']['discount'][$attr->id]) && $out['with_attr']['discount'][$attr->id] > 0) {
                         $out['with_attr']['price'][$attr->id] = $attr->retail_price - $attr->retail_price * ($out['with_attr']['discount'][$attr->id] / 100);
                     } else {
                         if (isset($out['with_attr']['price'][$attr->id]) && !$out['with_attr']['price'][$attr->id]) {
                             $out['with_attr']['price'][$attr->id] = $attr->sale_price ? $attr->sale_price : $attr->retail_price;
                         }
                     }
                 }
                 $out['sale'] = \Product\Model_Product::calculate_discount($product, $product_sale_price[0]->discount);
                 $out['price'] = \Product\Model_Product::calculate_discount($product, $product_sale_price[0]->price);
                 $out['price_type'] = 'sale_price';
                 // NRB-Gem: Set discounted rate from product_attribute_price Product attributes
                 if ($attributes_json) {
                     foreach ($current_attributes as $o_attribute) {
                         if ($o_attribute->product_attribute->attributes == $attributes_json) {
                             if ($out['with_attr']['able_discount'][$o_attribute->product_attribute->id]) {
                                 if ($out['with_attr']['discount'][$o_attribute->product_attribute->id] > 0) {
                                     $out['price'] = $out['retail_price'] - $out['retail_price'] * ($out['with_attr']['discount'][$o_attribute->product_attribute->id] / 100);
                                 } else {
                                     $out['price'] = $out['with_attr']['price'][$o_attribute->product_attribute->id];
                                 }
                             } else {
                                 $b_use_original_price = true;
                             }
                         }
                     }
                 }
             } else {
                 $out['price'] = \Product\Model_Product::calculate_discount($product, $attr_obj->retail_price);
                 $out['price_type'] = 'retail_price';
                 $b_use_original_price = true;
             }
             // NRB-Gem: Display original price if Discount price is not enabled (used by non-ajax request)
             if (\Uri::segment(1) == 'product' && !$attributes_json) {
                 $a_prod_attr_keys = array_keys($product_attributes);
                 $attr_id = $a_prod_attr_keys[0];
                 if (isset($out['with_attr']['able_discount'][$attr_id])) {
                     if (isset($out['with_attr']['discount']) && $out['with_attr']['discount'][$attr_id] > 0) {
                         $out['price'] = $out['retail_price'] - $out['retail_price'] * ($out['with_attr']['discount'][$attr_id] / 100);
                     } else {
                         $out['price'] = isset($out['with_attr']['price']) ? $out['with_attr']['price'][$attr_id] : '';
                     }
                 } else {
                     $b_use_original_price = true;
                     $attributes_json = true;
                 }
             }
             // NRB-Gem: Set original discounted rate for Product attributes
             if ($b_use_original_price && $attributes_json) {
                 if ($attr_obj->sale_price > 0) {
                     $out['price'] = $attr_obj->sale_price;
                     $out['price_type'] = 'sale_price';
                 } else {
                     $out['price'] = $attr_obj->retail_price;
                     unset($out['price_type']);
                 }
             }
         }
     } else {
         $p = $product->attributes[0];
         $out['current_attributes'] = null;
         $out['code'] = $p->product_code;
         $out['images'] = $p->images;
         $out['retail_price'] = $p->retail_price;
         $out['stock_quantity'] = $p->stock_quantity;
         $out['able_discount'] = isset($product_sale_price[0]) ? $product_sale_price[0]->able_discount : 0;
         if (!empty($product_sale_price) && $product_sale_price[0]->price != 0) {
             if ($out['able_discount']) {
                 $out['sale'] = \Product\Model_Product::calculate_discount($p, $product_sale_price[0]->discount);
                 $out['price'] = \Product\Model_Product::calculate_discount($p, $product_sale_price[0]->price);
             }
             $out['price_type'] = 'sale_price';
         } else {
             $out['sale'] = isset($product_sale_price[0]) ? $product_sale_price[0]->discount : 0;
             $out['price'] = \Product\Model_Product::calculate_discount($product, $p->retail_price);
             $out['price_type'] = 'retail_price';
         }
         // NRB-Gem: Display original price if Discount price is not enabled
         if ($out['able_discount']) {
             if ($product_sale_price[0]->discount > 0) {
                 $out['price'] = $p->retail_price - $p->retail_price * ($product_sale_price[0]->discount / 100);
             }
         } else {
             if ($p->sale_price > 0) {
                 $out['price'] = $p->sale_price;
                 $out['price_type'] = 'sale_price';
             } else {
                 unset($out['price_type']);
                 $out['price'] = $p->retail_price;
             }
         }
     }
     $prod_category = Model_Product_To_Categories::find_by_product_id($product->id);
     $category = \Product\Model_Category::find_one_by_id($prod_category[0]->category_id);
     $out['category_id'] = $prod_category ? $prod_category[0]->category_id : null;
     $out['category'] = $category ? $category->title : null;
     // Product without attributes
     if (empty($out['current_attributes'])) {
         $out['code'] = $product->code;
     }
     // Set images from product if there is no images in product attribute
     if (empty($out['images']) && !empty($product->images)) {
         $out['images'] = $product->images;
     }
     return $out;
 }
Beispiel #18
0
                                            Statistics
                                             <div class="btn-group pull-right">
                                                <a href="/admin/dashboard/d" class="glow left_button <?php 
echo Uri::segment(3) == 'd' ? 'active' : '';
?>
" >DAY</a>
                                                <a href="/admin/dashboard/w" class="glow middle_button <?php 
echo Uri::segment(3) == 'w' ? 'active' : '';
?>
">WEEK</a>
                                                <a href="/admin/dashboard/m" class="glow middle_button <?php 
echo Uri::segment(3) == 'm' ? 'active' : '';
?>
">MONTH</a>
                                                <a href="/admin/dashboard/y" class="glow right_button <?php 
echo Uri::segment(3) == 'y' ? 'active' : '';
?>
">YEAR</a>
                                            </div>
                                        </h4>
                                        <div class="wide">
                                            <div id="statsChart"></div>
                                        </div>
                                    </div>
                                    <!-- end statistics chart -->

                                    <!-- UI Elements section -->
                                    <!--<div class="row-fluid section ui-elements">
                                        <h4>Traffic Sources Overview</h4>
                                        <div class="knobs">
                                            <div class="knob-wrapper">
 public function create($year = NULL, $month = NULL)
 {
     // Gün, ay ve yıl bilgilerini alınıyor.
     $today = getdate();
     // Eğer parametreler boş ise
     // Varsayılan olarak URL adresinin
     // Son iki segmentini kullan
     // Son segment ay bilgisini
     // Sondan bir önceki segmen
     // yıl bilgisini tutmaktadır.
     if ($month === NULL && $year === NULL) {
         if (!is_numeric(Uri::segment(-1))) {
             $month = $today['mon'];
         } else {
             $month = Uri::segment(-1);
         }
         if (!is_numeric(Uri::segment(-2))) {
             $year = $today['year'];
         } else {
             $year = Uri::segment(-2);
         }
     } else {
         if (!is_numeric($month)) {
             $month = $today['mon'];
         }
         if (!is_numeric($year)) {
             $year = $today['year'];
         }
     }
     // Ay 0 değerine ulaştığında
     if ($month < 1) {
         $month = 12;
         $year--;
     } elseif ($month > 12) {
         $month = 1;
         $year++;
     }
     // Ay ismini sitenin aktif
     // diline göre ayarlar.
     if ($this->monthNames === 'long') {
         $monthNames = array_keys($this->config['monthNames'][getLang()]);
     } else {
         $monthNames = array_values($this->config['monthNames'][getLang()]);
     }
     $monthName = $monthNames[$month - 1];
     // Gün ismini sitenin aktif
     // diline göre ayarlar.
     $dayNames = $this->dayNames === 'long' ? array_keys($this->config['dayNames'][getLang()]) : array_values($this->config['dayNames'][getLang()]);
     // Belirtilen ayarlamara göre tarih bilgisi elde ediliyor.
     $firstDay = getdate(mktime(0, 0, 0, $month, 1, $year));
     $lastDay = getdate(mktime(0, 0, 0, $month + 1, 0, $year));
     // TABLO İÇİN CSS
     $tableClass = isset($this->css['table']) ? ' class="' . $this->css['table'] . '"' : '';
     // TABLO İÇİN STYLE
     $tableStyle = isset($this->style['table']) ? ' style="' . $this->style['table'] . '"' : '';
     // AY VE TARİH SÜTUNU İÇİN	CSS
     $monthRowClass = isset($this->css['monthName']) ? ' class="' . $this->css['monthName'] . '"' : '';
     // AY VE TARİH SÜTUNU İÇİN	STYLE
     $monthRowStyle = isset($this->style['monthName']) ? ' style="' . $this->style['monthName'] . '"' : '';
     // GÜN SÜTUNU İÇİN	CSS
     $dayRowClass = isset($this->css['dayName']) ? ' class="' . $this->css['dayName'] . '"' : '';
     // GÜN SÜTUNU İÇİN	STYLE
     $dayRowStyle = isset($this->style['dayName']) ? ' style="' . $this->style['dayName'] . '"' : '';
     // GÜN SAYILARI SÜTUNLARI İÇİN	CSS
     $rowsClass = isset($this->css['days']) ? ' class="' . $this->css['days'] . '"' : '';
     // GÜN SAYILARI SÜTUNLARI İÇİN	STYLE
     $rowsStyle = isset($this->style['days']) ? ' style="' . $this->style['days'] . '"' : '';
     // ÖNCEKİ VE SONRAKİ LİNKLERİ İÇİN	CSS
     $buttonClass = isset($this->css['links']) ? ' class="' . $this->css['links'] . '"' : '';
     // ÖNCEKİ VE SONRAKİ LİNKLERİ İÇİN	STYLE
     $buttonStyle = isset($this->style['links']) ? ' style="' . $this->style['links'] . '"' : '';
     // Önceki linki oluşturuluyor.
     $prev = "<a href='" . suffix($this->url) . $year . "/" . ($month - 1) . "' {$buttonClass}{$buttonStyle}>{$this->prev}</a>";
     // Sonraki linki oluşturuluyor.
     $next = "<a href='" . suffix($this->url) . $year . "/" . ($month + 1) . "' {$buttonClass}{$buttonStyle}>{$this->next}</a>";
     /************************************************************ CALENDAR *******************************************************************/
     $str = "<table{$tableClass}{$tableStyle}>" . eol();
     // Ay - Tarih Satırı
     $str .= "\t<tr>" . eol() . "\t\t<th{$monthRowClass}{$monthRowStyle} colspan=\"7\">{$prev} {$monthName} - {$year} {$next}</th></tr>" . eol();
     $str .= "\t<tr>" . eol();
     // Gün İsimleri Satırı
     foreach ($dayNames as $day) {
         $str .= "\t\t<td{$dayRowClass}{$dayRowStyle}>{$day}</td>" . eol();
     }
     $str .= "\t<tr>" . eol();
     if ($firstDay['wday'] == 0) {
         $firstDay['wday'] = 7;
     }
     // Günler Satırı
     for ($i = 1; $i < $firstDay['wday']; $i++) {
         $str .= "\t\t<td{$rowsClass}{$rowsStyle}>&nbsp;</td>" . eol();
     }
     $activeDay = 0;
     for ($i = $firstDay['wday']; $i <= 7; $i++) {
         $activeDay++;
         // Aktif gün için stil ve css kullanımı.
         if ($activeDay == $today['mday']) {
             $class = isset($this->css['current']) ? ' class="' . $this->css['current'] . '"' : '';
             $style = isset($this->style['current']) ? ' style="' . $this->style['current'] . '"' : '';
         } else {
             $class = isset($this->css['days']) ? ' class="' . $this->css['days'] . '"' : '';
             $style = isset($this->style['days']) ? ' style="' . $this->style['days'] . '"' : '';
         }
         $str .= "\t\t<td{$class}{$style}>{$activeDay}</td>" . eol();
     }
     $str .= "\t</tr>" . eol();
     $weekCount = floor(($lastDay['mday'] - $activeDay) / 7);
     for ($i = 0; $i < $weekCount; $i++) {
         $str .= "\t<tr>";
         for ($j = 0; $j < 7; $j++) {
             $activeDay++;
             // Aktif gün için stil ve css kullanımı.
             if ($activeDay == $today['mday']) {
                 $class = isset($this->css['current']) ? ' class="' . $this->css['current'] . '"' : '';
                 $style = isset($this->style['current']) ? ' style="' . $this->style['current'] . '"' : '';
             } else {
                 $class = isset($this->css['days']) ? ' class="' . $this->css['days'] . '"' : '';
                 $style = isset($this->style['days']) ? ' style="' . $this->style['days'] . '"' : '';
             }
             $str .= "\t\t<td{$class}{$style}>{$activeDay}</td>" . eol();
         }
         $str .= "\t</tr>" . eol();
     }
     if ($activeDay < $lastDay['mday']) {
         $str .= "\t<tr>" . eol();
         for ($i = 0; $i < 7; $i++) {
             $activeDay++;
             // Aktif gün için stil ve css kullanımı.
             if ($activeDay == $today['mday']) {
                 $class = isset($this->css['current']) ? ' class="' . $this->css['current'] . '"' : '';
                 $style = isset($this->style['current']) ? ' style="' . $this->style['current'] . '"' : '';
             } else {
                 $class = isset($this->css['days']) ? ' class="' . $this->css['days'] . '"' : '';
                 $style = isset($this->style['days']) ? ' style="' . $this->style['days'] . '"' : '';
             }
             if ($activeDay <= $lastDay['mday']) {
                 $str .= "\t\t<td{$class}{$style}>{$activeDay}</td>" . eol();
             } else {
                 $str .= "\t\t<td{$class}{$style}>&nbsp;</td>" . eol();
             }
         }
         $str .= "\t</tr>" . eol();
     }
     $str .= "</table>";
     $this->_defaultVariables();
     /************************************************************ CALENDAR *******************************************************************/
     return $str;
 }
Beispiel #20
0
<h1><?php 
echo \Uri::segment(4) == 'add' ? \Lang::get('blog_new_post') : \Lang::get('blog_edit_post');
?>
</h1>

<?php 
echo \Extension\Form::open(array('class' => 'form-horizontal', 'role' => 'form'));
?>
 
	<div class="form-status-placeholder">
		<?php 
if (isset($form_status) && isset($form_status_message)) {
    ?>
 
		<div class="alert alert-<?php 
    echo str_replace('error', 'danger', $form_status);
    ?>
"><button type="button" class="close" data-dismiss="alert">&times;</button><?php 
    echo $form_status_message;
    ?>
</div>
		<?php 
}
?>
 
	</div>
	<div class="hidden csrf-container">
		<?php 
echo \Extension\NoCsrf::generate();
?>
 
 /**
  * Parse module, action and args from uri
  * 
  * @param Uri $uri 
  * @return void
  */
 private function _parseFromUri(Uri $uri)
 {
     Log::debug('{Controller->_parseFromUri()} ' . $uri->getUri(false));
     if ($uri->nbSegments() === 0) {
         Error::showConfigurationError();
     }
     // load asset if exists
     $this->_loadAsset();
     $this->_module = strtolower($uri->segment(1));
     $this->_action = ucfirst_last($uri->segment(2, 'index'));
     $this->_args = $uri->segmentsSlice(3);
 }
Beispiel #22
0
	public function action_raw()
	{
		$short_id = Uri::segment(2);
		$scrap = Model_Scrap::find_by_short_id($short_id);

		if ($scrap)
		{
			$this->auto_render = false;
			$this->response->set_header('Content-Type', 'text/plain');
			$this->response->body = $scrap->contents;
		}
		else
		{
			$this->action_404();
		}
	}
Beispiel #23
0
    }
    ?>
							</div>
						</div>

<?php 
}
?>


				</div>
				<div class="row text-center">
					<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search icon-white"></i> フィルタ</button>
					<button type="button" class="btn btn-info btn-sm" name="filter-clear-btn"><i class="glyphicon glyphicon-refresh icon-white"></i> フィルタ解除</button>
					<a class="btn btn-warning btn-sm" id="btn_down_csv" href="<?php 
echo \Uri::base() . 'job/persons/index/' . (\Uri::segment(4) ? \Uri::segment(4) : 1) . '?' . http_build_query(\Input::get()) . '&export=true';
?>
"><i class="glyphicon glyphicon-download-alt icon-white"></i>CSVダウンロード</a>
				</div>
			</div>
		</div>
	</form>
		<?php 
if (count($listPerson) == 0) {
    ?>
		<div role="alert" class="alert alert-danger alert-dismissible">
			<button aria-label="Close" data-dismiss="alert" class="close" type="button">
				<span aria-hidden="true">×</span>
			</button>
			<?php 
    echo "該当するデータがありません";
Beispiel #24
0
 public function autoblock()
 {
     $uri = new Uri();
     $table = $uri->segment('fpp_actions');
     if ("tbl_" . $this->_Table == $table) {
         $action = $uri->segment($table);
         $id = $uri->segment($action);
         if ($this->_OnlyRead == TRUE) {
             if ($action == "read") {
                 return $this->blockfields($id);
             }
         } else {
             if ($action == "edit") {
                 return $this->blockfields($id);
             }
             if ($action == "ajax") {
                 $field = $uri->segment('ajaxfield');
                 $this->GetFieldAjax = $field;
                 if ($id == 0) {
                     $id = null;
                 }
                 return $this->blockfields($id);
             }
             if ($action == "add") {
                 return $this->blockfields(null);
             }
             if ($action == "delete") {
                 $this->deleterow($id);
                 $this->_messagesys = fpp::fppmsg('Item eliminado correctamente');
             }
         }
     }
     return $this->blocklist();
 }
Beispiel #25
0
<?php

echo render(Uri::segment(1) . '/_form');
Beispiel #26
0
			</div>
		</div>
		<div class="clearfix">
			<?php 
echo Form::label('Content', 'content');
?>

			<div class="input">
				<?php 
echo Form::textarea('content', Input::post('content', isset($comment) ? $comment->content : ''), array('class' => 'span8', 'rows' => 8));
?>

			</div>
		</div>
		<div class="input">
			<?php 
echo Form::hidden('entry_id', Uri::segment(4), array('class' => 'span4'));
?>

		</div>
		<br>
		<div class="actions">
			<?php 
echo Form::submit('submit', 'Add comment', array('class' => 'btn btn-success'));
?>

		</div>
	</fieldset>
<?php 
echo Form::close();
Beispiel #27
0
}
?>
		</pre>
		
		
		<?php 
if (isset($user)) {
    ?>
		<pre>
			<?php 
    print_r($user);
    ?>
		</pre>
		
		<?php 
    echo Html::anchor('article/nice/' . Uri::segment(3), 'ナイスボタンサンプル');
    ?>
		
		<?php 
    if (isset($form)) {
        ?>
		<?php 
        echo \Form::open(array('class' => 'form form-horizontal', 'enctype' => 'multipart/form-data'));
        ?>
		<?php 
        echo $form->field('comment');
        ?>
		<?php 
        echo $form->field('image');
        ?>
		<?php 
Beispiel #28
0
 public function create($start = NULL, $settings = array())
 {
     $settings = array_merge($this->settings, $settings);
     if (!empty($settings)) {
         $this->settings($settings);
     }
     $page = '';
     $links = '';
     // Sayfalama başlangıç parametresi boş ise
     // Uri bilgisindeki son segmenti
     // başlangıç değeri olarak ayarla
     if (empty($start)) {
         // Eğer son segmen sayısal bir veri değilse
         // Başlangıç değerini 0 olarak ayarla.
         if (!is_numeric(Uri::segment(-1))) {
             $startPage = 0;
         } else {
             // Son segment sayısal veri ise
             // başlangıç değeri olarak ayarla
             $startPage = Uri::segment(-1);
         }
     } else {
         // @start parametresi boş değilse
         // @start parametresi sayılsal bir veri değilse
         // başlangıç değeri olarak 0 ayarla
         if (!is_numeric($start)) {
             $start = 0;
         }
         // @start prametresi sayılsal bir değerse
         // bu değeri başlangıç değeri olarak ayarla.
         $startPage = $start;
     }
     // Kaç adet sayfa oluşacağı belirleniyor
     // Sayfa Sayısı = Toplam Satır / Limit
     $this->limit = $this->limit === 0 ? 1 : $this->limit;
     $perPage = ceil($this->totalRows / $this->limit);
     // Toplam link sayısı sayfa sayısından büyükse
     if ($this->countLinks > $perPage) {
         // lINKS Sayfalamada yer alacak linkler oluşturuluyor.
         // LINKS -------------------------------------------------------------------
         for ($i = 1; $i <= $perPage; $i++) {
             $page = ($i - 1) * $this->limit;
             // Kontrolere göre varsa stil veya sınıf verileri ekleniyor.
             if ($i - 1 == $startPage / $this->limit) {
                 $currentLink = isset($this->class['current']) ? 'class="' . $this->class['current'] . '"' : "";
                 $currentLinkStyle = isset($this->style['current']) ? 'style="' . $this->style['current'] . '"' : "";
             } else {
                 $currentLink = '';
                 $currentLinkStyle = '';
             }
             $classLinks = isset($this->class['links']) ? 'class="' . $this->class['links'] . '"' : "";
             $styleLinks = isset($this->style['links']) ? 'style="' . $this->style['links'] . '"' : "";
             $links .= '<a href="' . $this->url . $page . '" ' . $classLinks . ' ' . $styleLinks . '><span ' . $currentLink . ' ' . $currentLinkStyle . '> ' . $i . '</span></a>';
         }
         // LINKS -------------------------------------------------------------------
         // PREV Sonraki butonu ile ilgili kontrol yapılıyor.
         // PREV TAG ---------------------------------------------------------------
         if ($startPage != 0) {
             $classPrev = isset($this->class['prev']) ? 'class="' . $this->class['prev'] . '"' : "";
             $stylePrev = isset($this->style['prev']) ? 'style="' . $this->style['prev'] . '"' : "";
             $first = '<a href="' . $this->url . ($startPage - $this->limit) . '" ' . $classPrev . ' ' . $stylePrev . '>' . $this->prevTag . '</a>';
         } else {
             $first = '';
         }
         // PREV TAG ---------------------------------------------------------------
         // NEXT Sonraki butonu ile ilgili kontrol yapılıyor.
         // NEXT TAG ---------------------------------------------------------------
         if ($startPage != $page) {
             $classNext = isset($this->class['next']) ? 'class="' . $this->class['next'] . '"' : "";
             $styleNext = isset($this->style['next']) ? 'style="' . $this->style['next'] . '"' : "";
             $lastUrl = $this->url . ($startPage + $this->limit);
             $lastStcl = $classNext . ' ' . $styleNext;
             $last = '<a href="' . $lastUrl . '" ' . $lastStcl . '>' . $this->nextTag . '</a>';
         } else {
             $last = '';
         }
         // NEXT TAG ---------------------------------------------------------------
         if ($this->totalRows > $this->limit) {
             return $first . ' ' . $links . ' ' . $last;
         }
     } else {
         $perPage = $this->countLinks;
         // Linkler için class kontrolleri sağlanıyor. ------------------------------
         // LAST LINK
         $lastTagClass = isset($this->class['last']) ? ' class="' . $this->class['last'] . '" ' : '';
         // FIRST LINK
         $firstTagClass = isset($this->class['first']) ? ' class="' . $this->class['first'] . '" ' : '';
         // NEXT LINK
         $nextTagClass = isset($this->class['next']) ? ' class="' . $this->class['next'] . '" ' : '';
         // CURRENT LINK
         $currentLinkClass = isset($this->class['current']) ? ' class="' . $this->class['current'] . '" ' : '';
         // LINKS
         $linksClass = isset($this->class['links']) ? ' class="' . $this->class['links'] . '" ' : '';
         // PREV
         $prevTagClass = isset($this->class['prev']) ? ' class="' . $this->class['prev'] . '" ' : '';
         // -------------------------------------------------------------------------
         // Linkler için style kontrolleri sağlanıyor. ------------------------------
         // LAST LINK
         $lastTagStyle = isset($this->style['last']) ? ' style="' . $this->style['last'] . '" ' : '';
         // FIRST LINK
         $firstTagStyle = isset($this->style['first']) ? ' style="' . $this->style['first'] . '" ' : '';
         // NEXT LINK
         $nextTagStyle = isset($this->style['next']) ? ' style="' . $this->style['next'] . '" ' : '';
         // CURRENT LINK
         $currentLinkStyle = isset($this->style['current']) ? ' style="' . $this->style['current'] . '" ' : '';
         // LINKS
         $linksStyle = isset($this->style['links']) ? ' style="' . $this->style['links'] . '" ' : '';
         // PREV
         $prevTagStyle = isset($this->style['prev']) ? ' style="' . $this->style['prev'] . '" ' : '';
         // -------------------------------------------------------------------------
         // -------------------------------------------------------------------------
         // LAST TAG
         // -------------------------------------------------------------------------
         $lastTagNum = $this->url . ($this->totalRows - $this->totalRows % $this->limit - 1);
         $lastTagStyleClass = $lastTagClass . $lastTagStyle;
         $lastTag = '<a href="' . $lastTagNum . '"' . $lastTagStyleClass . '>' . $this->lastTag . '</a>';
         // -------------------------------------------------------------------------
         // -------------------------------------------------------------------------
         // FIRST TAG
         // -------------------------------------------------------------------------
         $firstTagStyleClass = $firstTagClass . $firstTagStyle;
         $firstTag = '<a href="' . $this->url . '0"' . $firstTagStyleClass . '>' . $this->firstTag . '</a>';
         // -------------------------------------------------------------------------
         if ($startPage > 0) {
             // -------------------------------------------------------------------------
             // PREV TAG
             // -------------------------------------------------------------------------
             $firstNum = $this->url . ($startPage - $this->limit);
             $fisrtStyleClass = $prevTagClass . $prevTagStyle;
             $first = '<a href="' . $firstNum . '"' . $fisrtStyleClass . '>' . $this->prevTag . '</a>';
             // -------------------------------------------------------------------------
         } else {
             $first = '';
         }
         if ($startPage / $this->limit == 0) {
             $pagIndex = 1;
         } else {
             $pagIndex = @ceil($startPage / $this->limit + 1);
         }
         if ($startPage < $this->totalRows - $this->limit) {
             // -------------------------------------------------------------------------
             // NEXT TAG
             // -------------------------------------------------------------------------
             $lastNum = $this->url . ($startPage + $this->limit);
             $lastStyleClass = $nextTagClass . $nextTagStyle;
             $last = '<a href="' . $lastNum . '"' . $lastStyleClass . '>' . $this->nextTag . '</a>';
             // -------------------------------------------------------------------------
         } else {
             $last = '';
             $lastTag = '';
             $pagIndex = @ceil($this->totalRows / $this->limit) - $this->countLinks + 1;
         }
         if ($pagIndex < 1 || $startPage == 0) {
             $firstTag = '';
         }
         $nPerPage = $perPage + $pagIndex - 1;
         if ($nPerPage >= @ceil($this->totalRows / $this->limit)) {
             $nPerPage = @ceil($this->totalRows / $this->limit);
             $lastTag = '';
             $last = '';
         }
         $links = '';
         for ($i = $pagIndex; $i <= $nPerPage; $i++) {
             $page = ($i - 1) * $this->limit;
             // Aktif sayfa linki kontrol ediliyor.
             if ($i - 1 == $startPage / $this->limit) {
                 $currentLink = $currentLinkClass . $currentLinkStyle;
             } else {
                 $currentLink = '';
             }
             // -------------------------------------------------------------------------
             // LINKS
             // -------------------------------------------------------------------------
             $linksStyleClass = $linksClass . $linksStyle;
             $links .= '<a href="' . $this->url . $page . '"' . $linksStyleClass . '><span ' . $currentLink . '> ' . $i . '</span></a>';
             // -------------------------------------------------------------------------
         }
         if ($this->totalRows > $this->limit) {
             return $firstTag . ' ' . $first . ' ' . $links . ' ' . $last . ' ' . $lastTag;
         }
     }
 }
Beispiel #29
0
    echo Uri::segment(2) == '' ? 'active' : '';
    ?>
">
                        <?php 
    echo Html::anchor('admin', 'Dashboard');
    ?>
                    </li>

                    <?php 
    $files = new GlobIterator(APPPATH . 'classes/controller/admin/*.php');
    foreach ($files as $file) {
        $section_segment = $file->getBasename('.php');
        $section_title = Inflector::humanize($section_segment);
        ?>
                        <li class="<?php 
        echo Uri::segment(2) == $section_segment ? 'active' : '';
        ?>
">
                            <?php 
        echo Html::anchor('admin/' . $section_segment, $section_title);
        ?>
                        </li>
                        <?php 
    }
    ?>
                </ul>
                <ul class="nav navbar-nav pull-right">
                    <li class="dropdown">
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#"><?php 
    echo $current_user->username;
    ?>
" name="skype">
		</div>
		<div class="form-group">
			<label><?php 
echo __('About Me', 'users');
?>
</label>
			<textarea class="form-control" name="about_me"><?php 
echo $user['about_me'];
?>
</textarea>
		</div>
		<div class="form-group">
			<label><?php 
echo __('New Password', 'users');
?>
</label>
			<input class="form-control" type="text" name="new_password">
		</div>
		<div class="form-group">
		<input type="submit" class="btn btn-primary" value="<?php 
echo __('Save', 'users');
?>
" name="edit_profile">
		<?php 
echo Html::anchor(__('Cancel', 'users'), Site::url() . '/users/' . Uri::segment(1), array('title' => __('Cancel', 'pages'), 'class' => 'btn btn-default'));
?>
		</div>
		</form>
	</div>
</div>