PHP Classes
elePHPant
Icontem

File: add.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michael J. Fuhrman  >  Todo List  >  add.php  >  Download  
File: add.php
Role: Example script
Content type: text/plain
Description: Adds a todo to the folder
Class: Todo List
Manage a list of tasks of a to do list
Author: By
Last change:
Date: 4 years ago
Size: 2,125 bytes
 

Contents

Class file image Download
<?
function dirPath() { return ("../../"); }

Include_Once (
dirPath() . "Shared/Classes/Ladder/Ladder_Ladder.cls");
Include_Once (
"Common_Panel.cls");
Include_Once (
"Task_Priorities.cls");
Include_Once (
"Task_Types.cls");
Include_Once (
"Calendar_Week.cls");
Include_Once (
"Common_Todo.cls");
Include_Once (
"Todo_View.cls");
Include_Once (
dirPath() . "Shared/_app.inc");

Function
php_Main ()
{
   
$nFolderID = 0;
    if (isset (
$_REQUEST ['nFolderID']))
       
$nFolderID = $_REQUEST ['nFolderID'];

   
// ==========================================
    // Validations

   
if ($nFolderID == 0) return;

   
// =======================================
    // Classes

   
$clsCommon_Todo = gblLadder()->getClass ("Common_Todo")->ID();

   
// ==========================================
    // Get Todos Folder

   
$fldrTarget = gblLadder()->getItem ($nFolderID);

   
// ==========================================
    // Get Item

   
$itmTodo = $fldrTarget->Create_Item ("Todo", "Test Todo", $clsCommon_Todo);

   
// ==========================================
    // Panels

   
$pnlTodo = new ENetArch_Panels_Common_Todo();

   
$pnlTask_Priorities = new ENetArch_Panels_Common_Task_Priorities();
   
$pnlTask_Types = new ENetArch_Panels_Common_Task_Types();

   
$pnlCalendar = new ENetArch_Panels_Common_Calendar_Week();

   
// ==========================================
    // View

   
$pnlCalendar->setPanelName ("ENetArch.Calendar");
   
$pnlCalendar->getSession ();

   
$pnlTodo->setPanelName ("ENetArch.Todos");
   
$pnlTodo->setPanelPriorities ($pnlTask_Priorities);
   
$pnlTodo->setPanelTaskTypes ($pnlTask_Types);
   
$pnlTodo->getPOST();

   
$pnlTodo->updateObject ($itmTodo);
   
$itmTodo->setField ("dTarget", $pnlCalendar->getDate());
   
$itmTodo->Store();

   
header ("Location:list.php?nFolderID=" . $nFolderID . "&");

    return;

   
// ==========================================
    // for testing

   
print ("<HR>");
    foreach (
$_REQUEST as $key => $value)
        print (
$key . " = " . $value . "<BR>\n");

    print (
"<table>\n");
   
$pnlTodo->printState();;
   
$pnlTodo->drawHeader();
   
$pnlTodo->drawPanel();
    print (
"</table>");

}
?>