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


PHP Jam::all方法代码示例

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


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

示例1: test_find_by_token

 public function test_find_by_token()
 {
     $current_time = time();
     $expected_sql = "SELECT `test_user_tokens`.* FROM `test_user_tokens` WHERE `test_user_tokens`.`token` = '59ed73c1a3c105e7409c69c21770d674949c07e9' AND `test_user_tokens`.`expires` >= {$current_time}";
     $sql = (string) Jam::all('test_user_token')->valid_token('59ed73c1a3c105e7409c69c21770d674949c07e9', $current_time);
     $this->assertEquals($expected_sql, $sql);
 }
开发者ID:Konro1,项目名称:pms,代码行数:7,代码来源:UserTokenTest.php

示例2: model_call_update_token

 public function model_call_update_token(Jam_Model $model, Jam_Event_Data $data)
 {
     do {
         $model->{$this->_field} = $this->new_token();
     } while (Jam::all($model->meta()->model())->where($this->_field, '=', $model->{$this->_field})->count_all() > 0);
     $data->return = $model;
 }
开发者ID:Konro1,项目名称:pms,代码行数:7,代码来源:Tokenable.php

示例3: test_collection_class

 public function test_collection_class()
 {
     $this->assertInstanceOf('Model_Collection_Test_Author', Jam::all('test_author'));
     $collection = Jam::all('test_author')->where_author(1);
     $this->assertCount(1, $collection->where);
     $this->assertInstanceOf('Jam_Query_Builder_Collection', Jam::all('test_blog'));
 }
开发者ID:Konro1,项目名称:pms,代码行数:7,代码来源:CoreTest.php

示例4: test_not_expired

 /**
  * @covers Model_Collection_Promotion::not_expired
  */
 public function test_not_expired()
 {
     $time = strtotime('2013-02-02');
     $sql = (string) Jam::all('promotion')->not_expired($time);
     $expected_sql = "SELECT `promotions`.* FROM `promotions` WHERE (`promotions`.`expires_at` IS NULL OR `promotions`.`expires_at` >= '2013-02-02 00:00:00')";
     $this->assertEquals($expected_sql, $sql);
 }
开发者ID:openbuildings,项目名称:promotions,代码行数:10,代码来源:PromotionTest.php

示例5: _load_token

 protected function _load_token($token)
 {
     if (!$token) {
         return NULL;
     }
     return is_object($token) ? $token : Jam::all('test_user_token')->valid_token($token)->first();
 }
开发者ID:Konro1,项目名称:pms,代码行数:7,代码来源:Test.php

示例6: test_render

    public function test_render()
    {
        $collection = Jam::all('test_city')->load_fields(array(array('id' => 1, 'name' => 'London', 'population' => 10), array('id' => 2, 'name' => 'New York', 'population' => 15)));
        $name = new Tart_Column();
        $name->sort(FALSE);
        $population = new Tart_Column();
        $population->sort(FALSE);
        $columns = array('name' => $name, 'population' => $population);
        $table = new Tart_Table($collection, $columns);
        $table->selected(FALSE);
        $expected = <<<HTML
<table class="table table-striped table-hover">
  <thead>
    <th>Name</th>
    <th>Population</th>
  </thead>
  <tbody>
    <tr class="test_city-1">
      <td>London</td>
      <td>10</td>
    </tr>
    <tr class="test_city-2">
      <td>New York</td>
      <td>15</td>
    </tr>
  </tbody>
</table>
HTML;
        $this->assertSame($expected, $table->render());
        $table->selected(array(1));
        $expected = <<<HTML_SELECTED
<table class="table table-striped table-hover">
  <thead>
    <th width="10">
      <input type="checkbox" name="all" value="1"/>
    </th>
    <th>Name</th>
    <th>Population</th>
  </thead>
  <tbody>
    <tr class="test_city-1">
      <td>
        <input type="checkbox" name="id[]" value="1" checked="1"/>
      </td>
      <td>London</td>
      <td>10</td>
    </tr>
    <tr class="test_city-2">
      <td>
        <input type="checkbox" name="id[]" value="2"/>
      </td>
      <td>New York</td>
      <td>15</td>
    </tr>
  </tbody>
</table>
HTML_SELECTED;
        $this->assertSame($expected, $table->render());
    }
开发者ID:openbuildings,项目名称:jam-tart,代码行数:59,代码来源:tableTest.php

示例7: generate_unique_token

 public function generate_unique_token()
 {
     do {
         $this->token = Model_Auth_User_Token::generate_token();
         $collection = Jam::all($this->meta()->model())->where_key($this->token)->limit(1);
     } while (Jam::all($this)->where('token', '=', $this->token)->limit(1)->count_all() > 0);
     return $this;
 }
开发者ID:Konro1,项目名称:pms,代码行数:8,代码来源:Token.php

示例8: assertPositions

 public function assertPositions($group, array $expected_positions)
 {
     $positions = Jam::all('test_video');
     if ($group) {
         $positions->where('group', '=', $group);
     }
     $this->assertSame($expected_positions, $positions->as_array('id', 'position'));
 }
开发者ID:Konro1,项目名称:pms,代码行数:8,代码来源:SortableTest.php

示例9: action_name

 public function action_name()
 {
     $q = $this->request->query('query');
     $model = $this->request->query('model');
     $names = Jam::all($model)->where(':name_key', 'LIKE', "%{$q}%")->limit(5);
     $this->response->headers('Content-Type', 'application/json');
     $this->response->body(json_encode($names->as_array(NULL, ':name_key')));
 }
开发者ID:openbuildings,项目名称:jam-tart,代码行数:8,代码来源:Typeahead.php

示例10: test_remember

 public function test_remember()
 {
     $user = Jam::find('test_user', 1);
     $token = $this->auth->remember($user);
     $jam_token = Jam::all('test_user_token')->valid_token($token->token)->first();
     $this->assertNotNull($jam_token);
     $this->auth->login_with_token($token);
     $this->assertTrue($this->auth->logged_in(), 'should be logged in after complete login');
 }
开发者ID:openbuildings,项目名称:jam-auth,代码行数:9,代码来源:JamTest.php

示例11: model_call_ansestors

 public function model_call_ansestors(Jam_Model $model, Jam_event_data $data)
 {
     $path_ids = $model->path_ids();
     if ($path_ids) {
         $data->return = Jam::all($model)->where($model->meta()->primary_key(), 'IN', $path_ids);
     } else {
         $data->return = Jam_Query_Builder_Collection::factory($model)->load_fields(array());
     }
 }
开发者ID:openbuildings,项目名称:jam-materialized-path,代码行数:9,代码来源:Materializedpath.php

示例12: test_table

 public function test_table()
 {
     $collection = Jam::all('test_city')->load_fields(array('id' => 1, 'name' => 'London'));
     $items = array('name' => Tart::column());
     $table = Tart::table($collection, $items);
     $this->assertInstanceOf('Tart_Table', $table);
     $this->assertEquals($collection, $table->collection());
     $this->assertEquals($items, $table->items());
 }
开发者ID:openbuildings,项目名称:jam-tart,代码行数:9,代码来源:coreTest.php

示例13: action_reorder

 public function action_reorder()
 {
     if ($this->request->method() === Request::POST) {
         Jam::all($this->request->query('model'))->sort_ids(Arr::get($this->request->post(), 'item', array()));
         $this->response->body('OK');
     } else {
         $this->response->body('Empty post');
     }
 }
开发者ID:openbuildings,项目名称:jam-tart,代码行数:9,代码来源:Modify.php

示例14: collection

 public function collection(Jam_Model $model)
 {
     $collection = Jam::all($this->foreign_model);
     $collection->join_table($this->join_table)->context_model($this->foreign_model)->on($this->association_foreign_key, '=', ':primary_key')->end()->where($this->join_table . '.' . $this->foreign_key, '=', $model->id());
     if ($this->join_table_paranoid) {
         $collection->where($this->join_table . '.' . $this->join_table_paranoid, '=', FALSE);
     }
     return $collection;
 }
开发者ID:emelkonyan,项目名称:jam,代码行数:9,代码来源:Manytomany.php

示例15: cetak_jadwal

 public function cetak_jadwal()
 {
     $tahun = Input::get('tahun');
     $t = DB::table('kelas')->where('kelas', '7')->count();
     $d = DB::table('kelas')->where('kelas', '8')->count();
     $s = DB::table('kelas')->where('kelas', '9')->count();
     $jam = Jam::all();
     return View::make('laporan.cetak_jadwal')->withTitle('Laporan Jadwal Pelajaran')->with('t', $t)->with('d', $d)->with('s', $s)->with('jam', $jam)->with('tahun', $tahun);
 }
开发者ID:jamalapriadi,项目名称:sia,代码行数:9,代码来源:LapController.php


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