<?php echo HtmlInput::title_box(_('Calendrier'), 'cal_div', 'zoom', "onclick=\"calendar_zoom({$obj})\""); echo $cal->display('short', 0); ?> </div> <div id="todo_listg_div" class="box"> <?php echo HtmlInput::title_box(_('Pense-Bête'), "todo_listg_div", 'zoom', " onclick=\"zoom_todo()\""); ?> <?php /* * Todo list */ echo dossier::hidden(); $todo = new Todo_List($cn); $array = $todo->load_all(); $a_todo = Todo_List::to_object($cn, $array); echo HtmlInput::button('add', _('Ajout'), 'onClick="add_todo()"', 'smallbutton'); echo '<table id="table_todo" class="sortable" width="100%">'; echo '<tr><th class=" sorttable_sorted_reverse" id="todo_list_date">Date <span id="sorttable_sortrevind"> ▴</span></th><th>Titre</th><th></th>'; if (!empty($array)) { $nb = 0; $today = date('d.m.Y'); foreach ($a_todo as $row) { if ($nb % 2 == 0) { $odd = 'odd '; } else { $odd = 'even '; } $nb++;
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()); }
} } //////////////////////////////////////////////////////////////////////////////// // Remove the share of a note which the connected user doesn't own // //////////////////////////////////////////////////////////////////////////////// if ($ac == "remove_share") { $id = HtmlInput::default_value_get("todo_id", 0); $p_login = HtmlInput::default_value_get("login", ""); // If note_id is not correct then give an error if ($id == 0 || isNumber($id) == 0 || trim($p_login) == "") { header('Content-type: text/xml; charset=UTF-8'); $dom = new DOMDocument('1.0', 'UTF-8'); $status = $dom->createElement('status', "nok"); $tl_id = $dom->createElement('content', _("Erreur : paramètre invalide")); $dom->appendChild($status); $dom->appendChild($tl_id); echo $dom->saveXML(); return; } $todo = new Todo_List($cn); $todo->set_parameter("id", $id); $todo->load(); $todo->remove_share($p_login); header('Content-type: text/xml; charset=UTF-8'); $dom = new DOMDocument('1.0', 'UTF-8'); $status = $dom->createElement('status', "ok"); $dom->appendChild($status); echo $dom->saveXML(); return; }
/** * Display the addList 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 addList($request, $match) { // The workflow of the addition of an item is simple // If the request of GET method a form is displayed // If it is a POST method, the form is submitted and the // content is proceeded to create the new list. // We create a Todo_List item as we are creating one here $list = new Todo_List(); if ($request->method == 'POST') { // We create the form bounded to the data submitted. $form = new Todo_Form_List($request->POST); if ($form->isValid()) { // If no errors, we can save the Todo_List from the data $list->setFromFormData($form->cleaned_data); $list->create(); // We redirect the user to the page of the Todo_List $url = Pluf_HTTP_URL_urlForView('Todo_Views::viewList', array($list->id)); return new Pluf_HTTP_Response_Redirect($url); } } else { $form = new Todo_Form_List(); } return Pluf_Shortcuts_RenderToResponse('todo/list/add.html', array('page_title' => 'Add a Todo List', 'form' => $form)); }