Example #1
0
 public function testUpdate()
 {
     $row = $this->table->create(array())->current();
     $data = array("created" => new \pq\DateTime("2013-03-03 03:03:03"), "counter" => 2, "number" => 2.2, "data" => "this is a test", "list" => array(3, 2, 1), "prop" => null);
     $row = $this->table->update(array("id = " => $row->id), $data)->current();
     $data = array("id" => $row->id->get()) + $data;
     $this->assertEquals($data, $row->getData());
 }
 /**
  * show all torrent or one based on search.
  *
  * @param Request $request
  *
  * @return \Illuminate\View\View
  */
 public function index(Request $request)
 {
     //$output =  \Tmdb::getSearchApi()->searchMovies('saw',array('language' => 'fr'));
     $perPage = 2;
     $input = $request->input('q');
     $tags = '';
     if ($request->input('tags') != '') {
         $tags = explode(',', $request->input('tags'));
     }
     if ($input && !$tags) {
         $rows = Movie::title($input)->sortAndPaginate($perPage);
     } elseif ($tags) {
         $rows = Movie::title($input)->tags($tags)->sortAndPaginate($perPage);
     } else {
         $rows = Movie::sortAndPaginate($perPage);
     }
     if (!$tags) {
         $tags = [];
     }
     $table = \Table::create($rows, ['test']);
     $table->addColumn('title', 'Nom', function ($torrent) {
         return $torrent->title;
     });
     $table->addColumn('created_at', 'Ajouté', function ($torrent) {
         return $torrent->created_at->diffForHumans();
     });
     return view('torrents.index', ['table' => $table, 'input' => $input, 'tags' => implode(',', $tags)]);
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 20) as $index) {
         Table::create(['number' => $index, 'seats' => $faker->randomElement([2, 4, 8]), 'position' => $faker->sentence(1), 'description' => $faker->text(200), 'available' => rand(0, 1), 'image_url' => $faker->imageUrl($width = 640, $height = 480)]);
     }
 }
 public function search(Request $request)
 {
     $post = $request->all();
     $query = $post['search'];
     $result = exam::where('exam_name', 'LIKE', '%' . $query . '%')->paginate(5);
     $table = \Table::create($result, ['id', 'exam_name', 'total_question', 'duration_per_que', 'mark_per_que', 'passing_marks', 'exam_status']);
     return view('admin.manage_exam')->with('searchResult', $table);
 }
 public function search(Request $request)
 {
     $post = $request->all();
     $que = $post['search'];
     $exam_id = $post['exam_id'];
     $result = question::where('question', 'LIKE', '%' . $que . '%')->where('exam_id', $exam_id)->paginate(5);
     $table = \Table::create($result, ['question', 'correct_ans']);
     return view('admin.manage_questions')->with('searchResult', $table)->with('exam_id', $exam_id);
 }
 public function show($config)
 {
     if (empty($config['view'])) {
         throw new \Exception(__METHOD__ . '. View parameter not defined.');
     }
     if (empty($config['name'])) {
         throw new \Exception(__METHOD__ . '. Javascript datatable variable name not defined.');
     }
     $other_info = array_key_exists('other-info', $config) ? $config['other-info'] : [];
     // $this->layout->title = strip_tags($config['caption']);
     if (!$config['form']) {
         $form = NULL;
     } else {
         $form = $config['form']::make()->other_info($other_info);
     }
     return view($config['view'], ['dt' => Table::create($config), 'toolbar' => \View::make($config['toolbar'])->with($other_info)->render(), 'form' => $form] + $other_info);
 }
$e->addField('openat');
$e->addField('time');
$e->addField('location');
$e->addField('short');
$e->addField('description');
$e->addField('archive');
$e->addField('hashtag');
$e->addField('facebook');
$e->addField('image');
$e->addField('imagesection');
$e->addField('gallery');
$e->addField('audio');
$e->addField('color');
$e->addField('number_staff');
$e->addField('number_visitors');
Table::create('categories', array('title'));
$c = new Table('categories');
$c->addField('deleted');
$c->addField('color');
$c->addField('hidden_in_archive');
Table::create('locations', array('title'));
$l = new Table('locations');
$l->addField('deleted');
$l->addField('website');
$l->addField('address');
$l->addField('lon');
$l->addField('lat');
// Add Options
Option::add('events_image_directory', '/');
Option::add('events_placeholder_archive', '');
Option::add('events_audio_directory', '/');
Example #8
0
<?php

require_once '../func/admin.class.php';
$authorizer = new Authorizer();
$uid = $authorizer->isLogged();
require_once '../func/admin.class.php';
require_once '../inc/vars.php';
if ($_POST['_check']) {
    if ($_POST['_name']) {
        $table = new Table(MT_TABLE);
        $table->create($_POST['_name']);
        die('<p>Table created succesfully</p><p><a href="#" onclick="return c_new_table()">Close</a></p>');
    } else {
        echo '<span class="error">Please provide a table name</span>';
    }
}
?>
<div id="form-small">	
    <form id="new_table" method="post" action="">
	
    <div class="form-row">
	<div class="field-label">Table Name</div>
	<div class="field-widget"><input type="text" name="_name" class="required" size="20"></div>
    </div>
	
    <input type="hidden" name ="_check" value="1"/>
	<input type="submit" value="Create" onclick="return new_table()"/>
	</form>
</div>
<?php

// Create the table
if (Table::create('slider', ['title', 'summary', 'link', 'category', 'target', 'order', 'misc_text', 'image'])) {
    // created a new table
}
$table = new Table('slider');
$table->updateField('button_class', 'misc_text');
$table->deleteField('has_button');
// Ensure there is a slider snipper (don't overwrite though)
$snippets_path = STORAGE . DS . 'snippets' . DS;
$install_path = PLUGINS . DS . 'slider' . DS . 'install' . DS;
if (!File::exists($snippets_path . 'slider.snippet.php')) {
    // Copy our default one
    File::copy($install_path . 'slider.default.snippet.php', $snippets_path . 'slider.snippet.php');
}
Example #10
0
 protected function renderRows(Rows $rows)
 {
     Table::create($rows)->render();
 }
 public function index()
 {
     $result = user::where('status', 1)->sorted()->paginate(5);
     $table = \Table::create($result, ['name', 'email']);
     return view('admin.admin_registration')->with('result', $table);
 }
Example #12
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testCreateInvalidData()
 {
     $table = new Table($this->connection, 'psx_handler_comment', array('foo' => TableInterface::TYPE_VARCHAR));
     $table->create('foo');
 }