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


PHP Site::first方法代码示例

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


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

示例1: lrsCanCreate

 /**
  * @param $role  Can the current user create LRS based on their role?
  *
  * @return boolean
  **/
 public static function lrsCanCreate()
 {
     $site = \Site::first();
     if (in_array(\Auth::user()->role, $site->create_lrs)) {
         return true;
     }
     return false;
 }
开发者ID:hsz-develop,项目名称:LearningLocker--learninglocker,代码行数:13,代码来源:Lrs.php

示例2: domain_check

 public function domain_check($data)
 {
     $site = \Site::first();
     //has a domain been set?
     if ($site) {
         $domain = $site->domain;
         if ($site->domain != '') {
             $allowed_domain = array($domain);
             // Make sure the address is valid
             if (filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
                 //get submitted email domain
                 $email = explode('@', $data['email']);
                 $email = array_pop($email);
                 if (!in_array($email, $allowed_domain)) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:hsz-develop,项目名称:LearningLocker--learninglocker,代码行数:21,代码来源:RegisterHandler.php

示例3: function

    return $server;
});
Route::get('/', function () {
    if (Auth::check()) {
        $site = \Site::first();
        $admin_dashboard = new \app\locker\data\dashboards\AdminDashboard();
        //if super admin, show site dashboard, otherwise show list of LRSs can access
        if (Auth::user()->role == 'super') {
            $list = Lrs::all();
            return View::make('partials.site.dashboard', array('site' => $site, 'list' => $list, 'stats' => $admin_dashboard->getFullStats(), 'graph_data' => $admin_dashboard->getGraphData(), 'dash_nav' => true));
        } else {
            $lrs = Lrs::where('users._id', \Auth::user()->_id)->get();
            return View::make('partials.lrs.list', array('lrs' => $lrs, 'list' => $lrs, 'site' => $site));
        }
    } else {
        $site = \Site::first();
        if (isset($site)) {
            return View::make('system.forms.login', array('site' => $site));
        } else {
            return View::make('system.forms.register');
        }
    }
});
/*
|------------------------------------------------------------------
| Login
|------------------------------------------------------------------
*/
Route::get('login', array('before' => 'guest', 'uses' => 'LoginController@create', 'as' => 'login.create'));
Route::post('login', array('before' => 'guest', 'uses' => 'LoginController@login', 'as' => 'login.store'));
Route::get('logout', array('uses' => 'LoginController@destroy', 'as' => 'logout'));
开发者ID:utkarshx,项目名称:learninglocker,代码行数:31,代码来源:routes.php

示例4: statements

 /**
  * Display statements for this LRS
  * @param String $lrs_id
  * @return View
  */
 public function statements($lrs_id)
 {
     $site = \Site::first();
     $statements = (new StatementIndexer())->index(new IndexOptions(['lrs_id' => new \MongoId($lrs_id), 'limit' => $this->statement->count(['lrs_id' => new \MongoId($lrs_id), 'scopes' => ['all']]), 'scopes' => ['all']]))->orderBy('statement.stored', 'DESC')->paginate(15);
     return View::make('partials.statements.list', array_merge($this->getLrs($lrs_id), ['statements' => $statements, 'statement_nav' => true, 'lang' => $site->lang]));
 }
开发者ID:utkarshx,项目名称:learninglocker,代码行数:11,代码来源:LrsController.php

示例5: defaultStatment

 /**
  * Return default statement data.
  */
 protected function defaultStatment()
 {
     $siteAttrs = \Site::first();
     return array('actor' => array('objectType' => 'Agent', 'mbox' => 'mailto:duy.nguyen@go1.com.au', 'name' => 'duynguyen'), 'verb' => array("id" => "http://adlnet.gov/expapi/verbs/experienced", "display" => array("und" => "experienced")), 'context' => array("contextActivities" => array("parent" => array("id" => "http://tincanapi.com/GolfExample_TCAPI", "objectType" => "Activity"), "grouping" => array("id" => "http://tincanapi.com/GolfExample_TCAPI", "objectType" => "Activity"))), "object" => array("id" => "http://tincanapi.com/GolfExample_TCAPI/Playing/Scoring.html", "objectType" => "Activity", "definition" => array("name" => array("en-US" => "Scoring"), "description" => array("en-US" => "An overview of how to score a round of golf."))), "authority" => array("name" => $siteAttrs->name, "mbox" => "mailto:" . $siteAttrs->email, "objectType" => "Agent"));
 }
开发者ID:jesposito,项目名称:learninglocker,代码行数:8,代码来源:TestCase.php

示例6: implode

      </div>
      <div class="wrapper">

        @if($errors->any())
          <ul class="alert alert-danger">
            {{ implode('', $errors->all('<li>:message</li>'))}}
          </ul>
        @endif
  
        @yield('content')

      </div>

      <div class="login-options">
        <?php 
$site = Site::first();
?>
        @if( isset($site) && $site->registration === 'Open' )
          <a href="{{ URL() }}/register" class="btn btn-sm btn-primary btn-login-options">{{ trans('site.register') }}</a>
        @endif
        <a href="{{ URL() }}/password/reset" class="btn btn-sm btn-default btn-login-options">{{ trans('site.forgotten_pw') }}</a>
      </div>

      <div class="links">
        Powered by <a href="http://learninglocker.net">Learning Locker</a>
      </div>

    </div>  
  </div>

@show
开发者ID:scmc,项目名称:learninglocker,代码行数:31,代码来源:loggedout.blade.php

示例7: inviteUser

 /**
  * Invite in a user. 
  **/
 public static function inviteUser($data)
 {
     //explode email addresses
     $emails = explode("\r\n", $data['emails']);
     foreach ($emails as $e) {
         $isMember = false;
         //make sure lower case
         $e = strtolower($e);
         //check it is a valid email address
         if (filter_var($e, FILTER_VALIDATE_EMAIL)) {
             //does the user already exist? If so, skip next step
             $user = \User::where('email', $e)->first();
             $user_exists = false;
             //boolean used to determine if add to lrs email sent
             if (!$user) {
                 //create a user account
                 $user = new \User();
                 $user->name = $e;
                 $user->email = $e;
                 $user->verified = 'no';
                 $user->role = $data['role'] ? $data['role'] : 'observer';
                 $user->password = \Hash::make(base_convert(uniqid('pass', true), 10, 36));
                 $user->save();
             } else {
                 $user_exists = true;
             }
             //was an LRS id passed? If so, add user to that LRS as an observer
             if (isset($data['lrs'])) {
                 $lrs = \Lrs::find($data['lrs']);
                 //is the user already a member of the LRS?
                 $isMember = \Locker\Helpers\Lrs::isMember($lrs->_id, $user->_id);
                 //if lrs exists and user is not a member, add them
                 if ($lrs && !$isMember) {
                     $existing = $lrs->users;
                     array_push($existing, array('_id' => $user->_id, 'email' => $user->email, 'role' => 'observer'));
                     $lrs->users = $existing;
                     $lrs->save();
                 }
             }
             //if user is already a member, exit here
             if ($isMember) {
                 continue;
             }
             //determine which message to send to the user
             if ($user_exists && isset($lrs)) {
                 //set data to use in email
                 $set_data = array('sender' => \Auth::user(), 'lrs' => $lrs);
                 //send out message to user
                 \Mail::send('emails.lrsInvite', $set_data, function ($message) use($user) {
                     $message->to($user->email, $user->name)->subject('You have been added to an LRS.');
                 });
             } elseif ($user_exists) {
                 //do nothing as they are already in the system
             } else {
                 //if adding to lrs, get lrs title, otherwise use the site name
                 isset($lrs) ? $title = 'the ' . $lrs->title . ' LRS' : ($title = \Site::first()->name . '\'s Learning Locker');
                 //set data to use in email
                 $set_data = array('token' => User::setEmailToken($user, $user->email), 'custom_message' => $data['message'], 'title' => $title, 'sender' => \Auth::user());
                 //send out message to user
                 \Mail::send('emails.invite', $set_data, function ($message) use($user) {
                     $message->to($user->email, $user->name)->subject('You have been invited to join our LRS.');
                 });
             }
         }
     }
 }
开发者ID:hsz-develop,项目名称:LearningLocker--learninglocker,代码行数:69,代码来源:User.php

示例8: Learner

<?php

$lang = \Site::first()->lang;
?>
{{ Form::open(array('route' => 'statements.store', 'class' => 'form-horizontal')) }}
  <div class="bordered">
    <h4><i class="icon icon-check"></i> Learner (actor)</h4>
    <div class="row">
      <div class="col-xs-12 col-sm-6 col-lg-6">
        <div class="form-group">
          {{ Form::label('actor_objectType', 'ObjectType', array('class' => 'col-sm-4 control-label' )) }}
          <div class="col-sm-8">
             {{ Form::select("actor[objectType]", array('Agent' => 'Agent' ), '', array('class' => 'form-control')) }}
          </div>
        </div>
      </div>
      <div class="col-xs-12 col-sm-6 col-lg-6">
        <div class="form-group">
          {{ Form::label('actor_name', 'Name', array('class' => 'col-sm-4 control-label' )) }}
          <div class="col-sm-8">
            {{ Form::text("actor[name]", '',array('class' => 'form-control')) }}
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-12 col-sm-6 col-lg-6">
        <div class="form-group">
          {{ Form::label('actor_identifier', 'Funcitonal Identifier', array('class' => 'col-sm-4 control-label' )) }}
          <div class="col-sm-8">
            {{ Form::select("", array('mbox' => 'mbox (email)' ), '', array('class' => 'form-control', 'required' => true)) }}
开发者ID:scmc,项目名称:learninglocker,代码行数:31,代码来源:add.blade.php

示例9: statements

 /**
  * Displays the statements from the report.
  * @param String $lrs_id
  * @param String $report_id
  * @return reporting view.
  */
 public function statements($lrs_id, $report_id)
 {
     $site = \Site::first();
     return View::make("{$this->views}.statements", array_merge($this->getLrs($lrs_id), ['reporting_nav' => true, 'statements' => $this->report->statements($report_id, ['lrs_id' => $lrs_id])->select('statement')->paginate(20), 'report' => $this->report->show($report_id, ['lrs_id' => $lrs_id]), 'lang' => $site->lang]));
 }
开发者ID:hsz-develop,项目名称:LearningLocker--learninglocker,代码行数:11,代码来源:ReportingController.php

示例10: create

 /**
  * @param array $statements An array of statements to create
  * @param array $lrs
  *
  **/
 public function create($statements, $lrs, $attachments = '')
 {
     //Full tincan statement validation to make sure the statement conforms
     $saved_ids = array();
     $site = \Site::first();
     $authority = ["name" => $site->name, "mbox" => "mailto:" . $site->email, "objectType" => "Agent"];
     foreach ($statements as &$statement) {
         //loop and amend - return on fail
         $verify = new \app\locker\statements\xAPIValidation();
         //run full validation
         $return = $verify->runValidation($statement, $authority);
         if ($return['status'] == 'failed') {
             return array('success' => 'false', 'message' => $return['errors']);
         } else {
             $statement = $return['statement'];
         }
     }
     //now we are sure that statements are valid - loop back through and actually add them
     foreach ($statements as $vs) {
         //check to see if the statementId already has a statement in the LRS
         if ($result = $this->doesStatementIdExist($lrs->_id, $vs['id'], $statement)) {
             return array('success' => $result);
         }
         //The date stored in LRS in ISO 8601 format
         $current_date = DateTime::createFromFormat('U.u', microtime(true));
         $current_date->setTimezone(new \DateTimeZone(\Config::get('app.timezone')));
         $vs['stored'] = $current_date->format('Y-m-d\\TH:i:s.uP');
         //if no timestamp, make it the same as stored
         if (!isset($vs['timestamp'])) {
             $vs['timestamp'] = $vs['stored'];
         }
         /*
         |------------------------------------------------------------------------------
         | For now we store the latest submitted definition. @todo this will change
         | when we have a way to determine authority to edit.
         |------------------------------------------------------------------------------
         */
         if (isset($vs['object']['definition'])) {
             $this->activity->saveActivity($vs['object']['id'], $vs['object']['definition']);
         }
         /*
         |------------------------------------------------------------------------------
         | Run through keys to make sure there are no full stops. If so, replace with
         | html entity &46; - this will probably only occur in extensions.
         |------------------------------------------------------------------------------
         */
         $vs = $this->replaceFullStop($vs);
         //Create a new statement object
         $new_statement = new Statement();
         $new_statement->lrs = array('_id' => $lrs->_id, 'name' => $lrs->title);
         $new_statement->statement = $vs;
         //now add our MongoData timestamp (based on statement timestamp) to use with Mongo Aggregation Function
         $new_statement->timestamp = new \MongoDate(strtotime($vs['timestamp']));
         if ($new_statement->save()) {
             $saved_ids[] = $new_statement->statement['id'];
         } else {
             return array('success' => 'false', 'message' => $new_statement->errors);
         }
     }
     //now we have saved statements, store attachments
     if ($attachments != '') {
         $this->storeAttachments($attachments, $lrs->_id);
     }
     return array('success' => true, 'ids' => $saved_ids);
 }
开发者ID:jesposito,项目名称:learninglocker,代码行数:70,代码来源:EloquentStatementRepository.php


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