Esempio n. 1
0
File: user.php Progetto: pshreez/PHP
 function userlist()
 {
     if (!F3::get('SESSION.asid')) {
         F3:
         reroute('/admin');
     }
     $user = new Axon('tbl_user');
     $users = array();
     $user_list = $user->find();
     if ($user_list != NULL) {
         foreach ($user_list as $ul) {
             $users[] = array($ul->email, $ul->username, '<img src="' . $ul->image . '" width="20px" height="20px" /> ' . $ul->fullname, $ul->active == 'y' ? 'Yes' : 'No', '<center><a href="#" class="blockLink" data-id="' . $ul->id . '">' . ($ul->active == 'y' ? 'Block' : 'Unblock') . '</a><br/><a href="#" class="deleteLink" data-id="' . $ul->id . '">Delete</a></center>');
         }
         $i = 0;
         foreach ($user_list as $user) {
             $user_id[] = $user_list[$i]->id;
             $i++;
         }
     } else {
         $users = 0;
         $user_id = 0;
     }
     $this->set('identity', $user_id);
     $this->set('userList', $users);
     $this->set('title', 'User');
     if (Snippets::_isAjax()) {
         echo Template::serve("template/admin/user.htm");
     } else {
         $this->set('template', 'user');
         echo Template::serve("template/admin/layout.htm");
     }
 }
Esempio n. 2
0
 function lst()
 {
     $user = new Axon('tbl_user');
     $report = array();
     $user->def("hits", "SELECT COUNT(date) FROM tbl_vote, tbl_poll WHERE date between '" . F3::get("POST.from") . "' and '" . F3::get("POST.to") . "'" . (F3::get("POST.telco") ? " and telco='" . F3::get("POST.telco") . "'" : "") . " and tbl_poll.id=tbl_vote.poll_id and tbl_poll.user_id=tbl_user.id group by tbl_user.id");
     if ($user->found() > 0) {
         $report_list = $user->find();
         foreach ($report_list as $rl) {
             $report[] = array('<img src="' . $rl->image . '" width="20px" height="20px" /> ' . $rl->fullname, $rl->hits ? $rl->hits : 0);
         }
     }
     $this->set('report', $report);
     echo Template::serve("template/admin/report_list.htm");
 }
Esempio n. 3
0
 function userList()
 {
     //the user who login to the system
     $operator = new Axon("admin");
     $operators = $operator->find();
     foreach ($operators as $users) {
         if ($users->type == 1) {
             $user[] = array($users->fullname, $users->username, $users->password, "all");
         } else {
             $user[] = array($users->fullname, $users->username, $users->password, $users->type == '21' ? '2' : '4');
         }
     }
     return $user;
 }
Esempio n. 4
0
File: zone.php Progetto: pshreez/PHP
 function getVdc()
 {
     //die(var_dump($this->get('PARAMS')));
     $district_name = $this->get('PARAMS.district_id');
     $content = $this->get('PARAMS.term');
     $district = new Axon('district');
     $district->load(array('name=:n', array(':n' => $district_name)));
     $district_id = $district->id;
     $vdc = new Axon('vdc_list');
     $vdc_list = $vdc->find(array("district_id=:did and name regexp '{$content}'", array(':did' => $district_id)));
     $return_vdcs = array();
     foreach ($vdc_list as $vl) {
         $return_vdcs[] = $vl->name;
     }
     echo json_encode($return_vdcs);
 }
Esempio n. 5
0
 function all()
 {
     $poll = new Axon('tbl_poll');
     //  echo 123;die;
     // $this->set('title', 'Quizzes');
     $poll->def('fullname', 'SELECT fullname FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('image', 'SELECT image FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id');
     $q = $poll->find('published_date IS NOT NULL AND is_archive="n" AND expiry_date>now() AND private="n"');
     $polls = array();
     foreach ($q as $qu) {
         $polls[$qu->id] = array(strtoupper($qu->keyword), $qu->question, '<img src="' . $qu->image . '" width="20px" height="20px" /> ' . $qu->fullname);
     }
     $this->set('title', 'All polls');
     $this->set('pollList', $polls);
     $this->set('template', 'all');
     echo Template::serve("template/layout.htm");
 }
Esempio n. 6
0
File: app.php Progetto: pshreez/PHP
 function mypolls()
 {
     if (!F3::get('SESSION.sid')) {
         F3::reroute('/home');
     }
     $tablePoll = new Axon('tbl_poll');
     $mypolls = $tablePoll->find(array('is_archive="n" AND expiry_date >now() AND user_id=:uid', array(':uid' => F3::get('SESSION.user')->id)));
     $polls = array();
     foreach ($mypolls as $poll) {
         if (!strpos($poll->question, '?')) {
             $poll->question .= "?";
         }
         $polls[] = array(strtoupper($poll->keyword), $poll->question, $poll->id, $poll->published_date, $poll->expiry_date);
     }
     // var_dump($polls);die;
     $date = DATE('Y-m-d');
     F3::set("nowDate", $date);
     F3::set('title', 'My Polls');
     F3::set('myList', $polls);
     F3::set('template', 'mypolls');
     echo Template::serve("template/layout.htm");
 }
Esempio n. 7
0
 function allPoll()
 {
     if (!F3::get('SESSION.asid')) {
         F3:
         reroute('/admin');
     }
     $poll = new Axon("tbl_poll");
     $poll->def('fullname', 'SELECT fullname FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('image', 'SELECT image FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id');
     $q = $poll->find();
     $users = array();
     foreach ($q as $qu) {
         $polls[$qu->id] = array(strtoupper($qu->keyword), $qu->question, '<img src="' . $qu->image . '" width="20px" height="20px" />' . $qu->fullname, date_create("now") >= date_create($qu->expiry_date) ? "Yes" : "No", $qu->published_date ? "Yes" : "No", $qu->published_date && date_create("now") < date_create($qu->expiry_date) && $qu->is_archive == "n" ? "Yes" : "No", $qu->private == 'y' ? "Private" : "Public", $qu->hits);
         if (!in_array($qu->fullname, $users)) {
             $users[] = $qu->fullname;
         }
     }
     F3::set('pollList', $polls);
     F3::set('users', $users);
     F3::set('template', 'poll');
     echo Template::Serve('template/admin/layout.htm');
 }
Esempio n. 8
0
<?php

// Retrieve blog entries
$kul = new Axon('kul');
F3::set('entries', $kul->find());
// Use the home.htm template
F3::set('pagetitle', 'ana sayfa');
F3::set('template', 'home');
F3::call('render');
Esempio n. 9
0
    }
    try {
        $newsfeed = $facebook->api('me/home', array('limit' => 50, 'filter' => 'fl_' . $user->fl_id));
    } catch (FacebookApiException $e) {
        F3::error('400');
    }
    /*
            function is_relationship_story($data){
                if(array_key_exists('story', $data) && preg_match('/went from being/', $data['story'])){
                    return true;
                }
                return false;
            }*/
    // Get number for people user follows
    $followed = new Axon('followed');
    $followed_count = count($followed->find(array('user_id=:user_id', array(':user_id' => $user->id))));
    F3::set('followed_count', $followed_count);
    // Make user a var for template use
    F3::set('user', array('fb_id' => $user->fb_id, 'name' => $user->name));
    F3::set('extra_css', array('dashboard.css'));
    echo Template::serve('templates/header.html');
    F3::set('newsfeed', $newsfeed['data']);
    F3::set('page', 'newsfeed');
    echo Template::serve('templates/newsfeed.html');
    F3::set('extra_js', array());
    echo Template::serve('templates/footer.html');
    die;
});
/* Logging in and logging out ***********************************************/
F3::route('GET /login', function () {
    $facebook = F3::get('Facebook');
Esempio n. 10
0
 function district_code()
 {
     $id = new Axon('district');
     $districts = $id->find();
     foreach ($districts as $district) {
         $list[] = array($district->id, $district->name);
     }
     // var_dump($list);die;
     F3::set('district_code', $list);
 }
Esempio n. 11
0
 function dataNamsari()
 {
     $date1 = F3::get("POST.date1");
     $date2 = F3::get("POST.date2");
     $status = F3::get("POST.status");
     // var_dump($status);die;
     $user = new Axon('vehicle');
     $wheeler_type = F3::get("SESSION.wheeler");
     //this value is from admin session 'type
     $wheeler_sql = $wheeler_type == 1 ? "" : " and wheeler='" . $wheeler_type . "'";
     $wheeler = array('21' => '2', '22' => '4');
     if ($user->found("date between '" . $date1 . "' and '" . $date2 . "' and form_type='namsari'  {$wheeler_sql} and status='" . $status . "'") < 1) {
         $data = array();
     } else {
         $list = $user->find("date between'" . $date1 . "' and '" . $date2 . "' and form_type='namsari' {$wheeler_sql} and status='" . $status . "'");
         foreach ($list as $lists) {
             $zone = $this->getZone($lists->zone_id);
             $symbol = $this->getSymbolType($lists->vehicle_symbol_type);
             // var_dump($symbol);die;
             $vehicleNo = $zone . $lists->lot_number . $symbol . $lists->number;
             // var_dump($veihcleNo);
             $w_type = $wheeler[$lists->wheeler];
             $data[] = array($vehicleNo, $lists->date, $lists->engine_num, $lists->chessis_num, $lists->model, $lists->ip_address, $w_type, $lists->id);
         }
     }
     F3::set('data', $data);
     F3::set('nav', 'navigation');
     F3::set('title', 'Admin - Namsari');
     F3::set('templateAdmin', 'namsariData');
     echo Template::serve("template/layout.html");
 }