コード例 #1
0
<?php

defined('ALT_PATH') or die('No direct access allowed.');
Alt_Validation::instance()->rule(Alt_Validation::not_empty($_REQUEST['description']), 'Deskripsi harus diisi!')->check();
$dbo = new Todo_Item();
return $dbo->insert($_REQUEST);
コード例 #2
0
<?php

defined('ALT_PATH') or die('No direct access allowed.');
Alt_Validation::instance()->rule(Alt_Validation::not_empty($_REQUEST['itemid']), 'Item belum dipilih!')->check();
$dbo = new Todo_Item();
return $dbo->retrieve($_REQUEST);
コード例 #3
0
ファイル: TestTodo.php プロジェクト: burbuja/pluf
 public function testCreateItem()
 {
     $list = new Todo_List();
     $list->name = 'Test list';
     $this->assertEqual(true, $list->create());
     $this->lists[] = $list;
     // to have it deleted in tearDown
     $item = new Todo_Item();
     $item->list = $list;
     $item->item = 'Create unit tests';
     $this->assertEqual(true, $item->create());
     $nlist = $item->get_list();
     $this->assertEqual($nlist->id, $list->id);
     $items = $list->get_todo_item_list();
     $this->assertEqual(1, $items->count());
     $item2 = new Todo_Item();
     $item2->list = $list;
     $item2->item = 'Create more unit tests';
     $item2->create();
     // first list has 2 items.
     $this->assertEqual(2, $list->get_todo_item_list()->count());
     $list2 = new Todo_List();
     $list2->name = 'Test list 2';
     $this->assertEqual(true, $list2->create());
     $this->lists[] = $list2;
     // to have it deleted in tearDown
     $this->assertEqual(0, $list2->get_todo_item_list()->count());
     // Move the item in the second list.
     $item2->list = $list2;
     $item2->update();
     // One item in each list.
     $this->assertEqual(1, $list2->get_todo_item_list()->count());
     $this->assertEqual(1, $list->get_todo_item_list()->count());
 }
コード例 #4
0
<?php

defined('ALT_PATH') or die('No direct access allowed.');
Alt_Validation::instance()->rule(Alt_Validation::not_empty($_REQUEST['itemid']), 'Item belum dipilih!')->rule(Alt_Validation::not_empty($_REQUEST['description']), 'Deskripsi harus diisi!')->check();
$dbo = new Todo_Item();
return $dbo->update($_REQUEST);
コード例 #5
0
ファイル: Views.php プロジェクト: burbuja/pluf
 /**
  * Display the viewItem page of the application.
  *
  * @param Pluf_HTTP_Request Request object
  * @param array Matches against the regex of the dispatcher
  * @return Pluf_HTTP_Response or can throw Exception
  */
 public function viewItem($request, $match)
 {
     // Basically the same as the viewList view but with a Todo_Item
     $item_id = $match[1];
     // We now are loading the corresponding item
     $item = new Todo_Item($item_id);
     // And check that the item has been found
     if ($item->id != $item_id) {
         return new Pluf_HTTP_Response_NotFound('The item has not been found.');
     }
     // Now we get the list in wich the item is
     $list = $item->get_list();
     // We have the item and the list, just display them. Instead of
     // creating a context, then a template and then rendering it
     // within a response object, we are going to use a shortcut
     // function. Using shortcuts is better as you end up having a
     // cleaner code.
     return Pluf_Shortcuts_RenderToResponse('todo/item/view.html', array('page_title' => 'View Item', 'list' => $list, 'item' => $item));
 }
コード例 #6
0
<?php

defined('ALT_PATH') or die('No direct access allowed.');
Alt_Validation::instance()->rule(Alt_Validation::not_empty($_REQUEST['itemid']), 'Item belum dipilih!')->check();
$dbo = new Todo_Item();
return $dbo->delete($_REQUEST);
コード例 #7
0
ファイル: list.php プロジェクト: akhdani/academy-altphp-intro
<?php

defined('ALT_PATH') or die('No direct access allowed.');
$dbo = new Todo_Item();
return $dbo->get($_REQUEST);