当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseController::get_user_logged_in方法代码示例

本文整理汇总了PHP中BaseController::get_user_logged_in方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseController::get_user_logged_in方法的具体用法?PHP BaseController::get_user_logged_in怎么用?PHP BaseController::get_user_logged_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseController的用法示例。


在下文中一共展示了BaseController::get_user_logged_in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_if_admin

function check_if_admin()
{
    $user = BaseController::get_user_logged_in();
    if (!$user->admin) {
        Redirect::to('/', array('error' => 'Toiminto on tarkoitettu vain sivuston ylläpitäjälle'));
    }
}
开发者ID:emivo,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:routes.php

示例2: make

 public static function make($view, $content = array())
 {
     // Alustetaan Twig
     $twig = self::get_twig();
     $rendered_page = "";
     $twig->addFilter(new Twig_SimpleFilter('cast_to_array', function ($stdClassObject) {
         $response = array();
         foreach ($stdClassObject as $key => $value) {
             $response[] = array($key, $value);
         }
         return $response;
     }));
     try {
         // Asetetaan uudelleenohjauksen yhteydessä lisätty viesti
         self::set_flash_message($content);
         // Asetetaan näkymään base_path-muuttuja index.php:ssa määritellyllä BASE_PATH vakiolla
         $content['base_path'] = BASE_PATH;
         // Asetetaan näkymään kirjautunut käyttäjä, jos get_user_logged_in-metodi on toteutettu
         if (method_exists('BaseController', 'get_user_logged_in')) {
             $content['user_logged_in'] = BaseController::get_user_logged_in();
         }
         // Asetetaan näkymään kirjautunut admin-käyttäjä, jos get_admin_logged_in-metodi on toteutettu
         if (method_exists('BaseController', 'get_admin_logged_in')) {
             $content['admin_logged_in'] = BaseController::get_admin_logged_in();
         }
         // Tulostetaan Twig:n renderöimä näkymä
         $rendered_page = $twig->render($view, $content);
         echo $rendered_page;
     } catch (Exception $e) {
         die('Virhe näkymän näyttämisessä: ' . $e->getMessage());
     }
     // exit();
     return $rendered_page;
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:34,代码来源:view.php

示例3: check_user_is_manager

 public static function check_user_is_manager()
 {
     BaseController::check_logged_in();
     if (!BaseController::get_user_logged_in()->manager) {
         Redirect::to(\Slim\Slim::getInstance()->urlFor('index'), array('message' => 'Sinulla ei ole oikeuksiä käyttää toimintoa!', 'error' => true));
     }
 }
开发者ID:laazz,项目名称:talpa,代码行数:7,代码来源:base_controller.php

示例4: index

 public static function index()
 {
     self::check_logged_in();
     $ryhmemos = Memo::all_groupmemos(BaseController::get_user_logged_in());
     $memos = Memo::all(BaseController::get_user_logged_in());
     View::make('memo/index.html', array('memos' => $memos, 'ryhmemos' => $ryhmemos));
 }
开发者ID:Hecarrah,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:memoController.php

示例5: save

 public function save()
 {
     $query = DB::connection()->prepare('INSERT INTO Askare (perheenjasen_id, nimi, tarkeys, lisatty, valmis, muuta)VALUES(:perheenjasen_id, :nimi, :tarkeys, NOW(), :valmis, :muuta)RETURNING id');
     $query->execute(array('perheenjasen_id' => BaseController::get_user_logged_in()->id, 'nimi' => $this->nimi, 'tarkeys' => $this->tarkeys, 'valmis' => $this->valmis, 'muuta' => $this->muuta));
     $row = $query->fetch();
     Kint::dump($row);
     $this->id = $row['id'];
 }
开发者ID:heltsu,项目名称:Tsoha-Bootstrap,代码行数:8,代码来源:askare.php

示例6: destroy

 public static function destroy($id)
 {
     if (parent::is_admin() || parent::get_user_logged_in()->id == $id) {
         User::destroy($id);
         Redirect::to("/user", array('message' => "User was destroyed."));
     } else {
         Redirect::to("/", array('message' => "You are not an admin or user# " . $id));
     }
 }
开发者ID:tuureilmarinen,项目名称:tsoha,代码行数:9,代码来源:user_controller.php

示例7: make

 public static function make($file, $content = array())
 {
     $twig = self::get_twig();
     if (BaseController::get_flash() != null) {
         $content['flash'] = BaseController::get_flash();
         BaseController::set_flash(null);
     }
     $content['user_logged_in'] = BaseController::get_user_logged_in();
     echo $twig->render($file, $content);
 }
开发者ID:hyttijan,项目名称:MyImgur,代码行数:10,代码来源:View.php

示例8: editLease

 public static function editLease($id, $leaseId)
 {
     if (parent::logged_in_user_is_landlord_of($id)) {
         $unit = RentalUnit::find($id);
         $lease = Lease::find($leaseId);
         $amenities = Amenity::all_and_check(Amenity::LEASE, $leaseId);
         $user = parent::get_user_logged_in();
         View::make('lease/lease_modify.html', array('lease' => $lease, 'unit' => $unit, 'amenities' => $amenities, 'user' => $user, 'input' => array('tenant' => $lease->tenant, 'tenant_email' => $lease->tenant_email, 'rent' => $lease->rent, 'start_date' => $lease->start_date, 'end_date' => $lease->end_date), 'edit' => true));
     }
     Redirect::to('/units/' . $id, array('message' => 'insufficient rights'));
 }
开发者ID:jussiviinikka,项目名称:Tsoha-Bootstrap,代码行数:11,代码来源:lease_controller.php

示例9: all

 public static function all()
 {
     $query = DB::connection()->prepare('SELECT * FROM Survey WHERE person = :person');
     $user = BaseController::get_user_logged_in();
     $query->execute(array('person' => $user->id));
     $rows = $query->fetchAll();
     $surveys = array();
     foreach ($rows as $row) {
         $surveys[] = new Survey(array('id' => $row['id'], 'person' => $row['person'], 'description' => $row['description'], 'min_value' => $row['min_value'], 'max_value' => $row['max_value'], 'type' => $row['type']));
     }
     return $surveys;
 }
开发者ID:banjohirvi,项目名称:Tsoha-Bootstrap,代码行数:12,代码来源:survey.php

示例10: index

 public static function index()
 {
     $user = BaseController::get_user_logged_in();
     $services = array();
     $deleted_services = null;
     if ($user->manager) {
         $services = Service::all();
         $deleted_services = Service::all_deleted();
     } else {
         $services = Service::all_for_user($user->id);
     }
     View::make('service/index.html', array('services' => $services, 'deleted_services' => $deleted_services));
 }
开发者ID:laazz,项目名称:talpa,代码行数:13,代码来源:service_controller.php

示例11: viewUnit

 public static function viewUnit($id)
 {
     $unit = RentalUnit::find($id);
     $amenities = Amenity::all_and_check(Amenity::RENTAL_UNIT, $id);
     $landlord = User::find($unit->landlord);
     $user = parent::get_user_logged_in();
     $leases = Lease::find_leases_for($id);
     $disabled = null;
     if ($user->id != $landlord->id) {
         $disabled = 'disabled';
     }
     View::make('rental_unit/unit.html', array('unit' => $unit, 'amenities' => $amenities, 'landlord' => $landlord, 'leases' => $leases, 'disabled' => $disabled));
 }
开发者ID:jussiviinikka,项目名称:Tsoha-Bootstrap,代码行数:13,代码来源:rental_unit_controller.php

示例12: lisaaVastaus

 public static function lisaaVastaus($aiheId)
 {
     $lomakkeenTiedot = $_POST;
     $aihe = Aihe::haeYksi($aiheId);
     $viestit = $aihe->vastaukset();
     $aloitus = $viestit[0];
     $vastaus = new Vastaus(array('otsikko' => $aloitus->otsikko, 'teksti' => $lomakkeenTiedot['teksti'], 'laatija' => BaseController::get_user_logged_in()->id, 'aihe' => $aiheId));
     $errors = $vastaus->errors();
     if (count($errors) == 0) {
         $vastaus->lisaa();
         Redirect::to('/aihe/' . $vastaus->aihe);
     } else {
         View::make('uusiVastaus.html', array('aihe' => $aihe, 'teksti' => $vastaus->teksti, 'virheet' => $errors));
     }
 }
开发者ID:ealiasannila,项目名称:Tsoha-Bootstrap,代码行数:15,代码来源:VastausController.php

示例13: add

 public static function add($parameters)
 {
     $parameters['userid'] = parent::get_user_logged_in()->id;
     $parameters['username'] = parent::get_user_logged_in()->username;
     $image = Image::find($parameters['image']);
     $comment = new Comment($parameters);
     $errors = $comment->errors();
     if (count($errors) == 0) {
         $comment->save();
         $content['success'] = "Comment was added";
     } else {
         $content['errors'] = $errors;
     }
     return $content;
 }
开发者ID:hyttijan,项目名称:MyImgur,代码行数:15,代码来源:CommentController.php

示例14: updatePassword

 public static function updatePassword()
 {
     $params = $_POST;
     $user = BaseController::get_user_logged_in();
     if ($user == null) {
         flash()->error('User was not found!');
         Redirect::to('/users');
     }
     $user->password = $params['password'];
     $errors = $user->errors();
     if (count($errors) > 0) {
         flash()->error(':(', 'Something was a little off...');
         Redirect::to('/profile/edit', array('errors' => $errors, 'attributes' => $params));
     }
     $user->update();
     flash(':)', 'Password updated successfully!');
     Redirect::to('/');
 }
开发者ID:KristianLauttamus,项目名称:HospitalSchedule,代码行数:18,代码来源:ProfileController.php

示例15: lisaaAihe

 public static function lisaaAihe($alueId)
 {
     $lomakkeenTiedot = $_POST;
     $aihe = new Aihe(array('aihealue' => $alueId));
     $virheetAihe = $aihe->errors();
     if (count($virheetAihe) == 0) {
         $aloitus = new Vastaus(array('otsikko' => $lomakkeenTiedot['otsikko'], 'teksti' => $lomakkeenTiedot['teksti'], 'laatija' => BaseController::get_user_logged_in()->id, 'aihe' => -1));
         $virheetAloitus = $aloitus->errors();
         if (count($virheetAloitus) == 0) {
             $aihe->lisaa();
             $aloitus->aihe = $aihe->id;
             $aloitus->lisaa();
             Redirect::to('/aihe/' . $aihe->id);
         }
     }
     $aihealue = Aihealue::haeYksi($alueId);
     View::make('uusiAihe.html', array('aihealue' => $aihealue, 'virheet' => $virheetAloitus, 'aloitus' => $aloitus));
 }
开发者ID:ealiasannila,项目名称:Tsoha-Bootstrap,代码行数:18,代码来源:AiheController.php


注:本文中的BaseController::get_user_logged_in方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。