Example #1
0
 /**
  * Name: getData
  * 
  * @param type $url link za paginaciju
  * @param type $cookie_name naziv kolacica
  * @param type $is_archive da li je anketa arhivira ili nije; 1 - jeste, 0 - nije
  */
 function getData($url, $cookie_name, $is_archive = 0)
 {
     $q = get_cookie($cookie_name);
     $perPage = $this->input->post('perPage');
     $perP = $perPage ? $perPage : $q;
     $has_error = 0;
     $message = __('Uspesno dobavljeni podaci!!', $this->template['module']);
     // var_dump($message); exit;
     if (is_numeric($this->anketa->getTotalRows($is_archive))) {
         pagination($url, $this->anketa->getTotalRows($is_archive), $perP, '4', 'ankete');
     } else {
         $has_error = 2;
         $message = "Doslo je do greske.";
     }
     $page = uri_segment('4');
     if (!($data = $this->anketa->fetch_ankete($perP, $page, $is_archive))) {
         $has_error = 1;
         $message = __('Trenutno nema anketa!!! Unesite anketu klikom na', $this->template['module']);
     }
     if (!empty($data)) {
         $redni_broj = isset($page) ? $page : 0;
         foreach ($data as $anketa) {
             $anketa->datum_kreiranja = formatDate($anketa->datum_kreiranja);
             $anketa->redni_broj = ++$redni_broj;
         }
     }
     $links = create_links();
     $uri = $page;
     $result = array('data' => $data, 'links' => $links, 'error' => $has_error, 'uri' => $uri, 'poruka' => $message);
     $this->response($result);
 }
Example #2
0
<?php

$slug = uri_segment(2);
if ($slug) {
    $article = fuel_model('articles', array('find' => 'one', 'where' => array('slug' => $slug)));
    if (empty($article)) {
        redirect_404();
    }
} else {
    $tags = fuel_model('tags');
}
if (!empty($article)) {
    ?>
	
	<h1><?php 
    echo fuel_edit($article);
    echo $article->title;
    ?>
</h1>
	<div class="author"><?php 
    echo $article->author->name;
    ?>
</div>
	<img src="<?php 
    echo $article->image_path;
    ?>
" alt="<?php 
    echo $article->title_entities;
    ?>
" class="img_right" />
	<article><?php 
Example #3
0
<?php

/*
This is an example of a Fuel_module_layout where you have a list view and an item view
*/
$param = uri_segment($segment);
// check if there is a uri segment
if ($param) {
    // if the uri segment is numeric, then search by key
    if (is_numeric($param)) {
        $item = fuel_model($model, array('find' => 'key', 'where' => $param));
    } else {
        // otherwise we search by find one
        if (empty($item_where)) {
            $item_where = array($key_field => $param);
        }
        $item = fuel_model($model, array('find' => 'one', 'where' => $item_where));
    }
    // if no item is found, then do a redirect or 404 if no redirect exists
    if (empty($item)) {
        redirect_404();
    }
} else {
    // if no uri segment, then we do a query on the model to get a list of data
    if (empty($list_where)) {
        $list_where = array();
    }
    $data = fuel_model($model, array('find' => 'all', 'where' => $list_where));
}
?>
Example #4
0
 function manifest()
 {
     $file = uri_segment(2);
     $contents = $this->_load_manifest($file, $this->_config('use_cache'));
 }
Example #5
0
                            </script>
                        </div>
                    </div>
                    <?php 
//Load message block
Library('block')->load('page_html/message');
//Load Content Block
Library('block')->load($content_block, 'sketchawebsite');
?>
                </div>

                <p>&nbsp;</p>

                <div id="pagination"><?php 
if (isset($data->pagination)) {
    echo str_replace('http://templates.zoosper.org/cat', site_url() . uri_segment(1), $data->pagination);
}
?>
</div>

            </div>
            <div class="comments"></div>
        </div>
      </div>
      <!-- [END] Page -->
    </div>
    <!-- [END] Page Wrap -->
    <!-- sidebar -->
    <div id="sidebar">
      <!-- Subscriptions -->
      <div class="sidebar_subscribe"></div>
 <?php 
$action = uri_segment(3);
$post = get_post();
// auto sanitize
switch ($action) {
    case 'tampil':
        $return = db_fetch_one("SELECT * FROM products WHERE id= ?", array($post['id']));
        echo json_encode($return);
        break;
    case 'save':
        $id = $post['id'];
        $name = $post['name'];
        $slug = $post['slug'];
        $category = $post['category'];
        $cek = db_fetch_one("SELECT * FROM products WHERE slug = ?", array($slug));
        if (!$name || !$slug || !$category) {
            echo "Data tidak lengkap !";
        } else {
            if (!empty($cek)) {
                echo "Sudah ada data slug yang sama !";
            } else {
                $simpan = db_query("INSERT INTO products (name, slug, category) VALUES (?, ?, ?)", array($name, $slug, $category));
                if ($simpan) {
                    echo "Data berhasil disimpan";
                } else {
                    echo "Data gagal disimpan";
                }
            }
        }
        break;
    case 'update':
Example #7
0
<?php

// declared here so we don't have to in each controller's variable file
$CI =& get_instance();
// generic global page variables used for all pages
$vars = array();
$vars['layout'] = 'main';
//$vars['page_title'] = fuel_nav(array('render_type' => 'page_title', 'delimiter' => ' : ', 'order' => 'desc', 'home_link' => 'Home'));
$vars['js'] = array();
$vars['css'] = array();
$vars['body_class'] = uri_segment(1) . ' ' . uri_segment(2);
$vars['og_image'] = base_url() . "assets/flat_img/9icase.png";
// page specific variables
$pages = array();