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


PHP Task::getAll方法代码示例

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


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

示例1: testSimpleUserImportWhereAllRowsSucceed

 public function testSimpleUserImportWhereAllRowsSucceed()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $tasks = Task::getAll();
     $this->assertEquals(0, count($tasks));
     $import = new Import();
     $serializedData['importRulesType'] = 'Tasks';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('simpleImportTest.csv', $import->getTempTableName(), Yii::getPathOfAlias('application.modules.tasks.tests.unit.files'));
     $this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeDateTimeColumnMappingData('dueDateTime'), 'column_2' => ImportMappingUtil::makeDateTimeColumnMappingData('completedDateTime'), 'column_3' => ImportMappingUtil::makeBooleanColumnMappingData('completed'), 'column_4' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived'), 'column_5' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived'), 'column_6' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived'), 'column_7' => ImportMappingUtil::makeTextAreaColumnMappingData('description'));
     $importRules = ImportRulesUtil::makeImportRulesByType('Tasks');
     $page = 0;
     $config = array('pagination' => array('pageSize' => 50));
     //This way all rows are processed.
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $actionDateTime = substr(DateTimeUtil::convertTimestampToDbFormatDateTime(time()), 0, -3);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 3 models where created.
     $tasks = Task::getAll();
     $this->assertEquals(3, count($tasks));
     $tasks = Task::getByName('task1');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testAccount', $tasks[0]->activityItems[0]->name);
     $this->assertEquals('Account', get_class($tasks[0]->activityItems[0]));
     $this->assertNull($tasks[0]->completed);
     $this->assertEquals($actionDateTime, substr($tasks[0]->latestDateTime, 0, -3));
     $tasks = Task::getByName('task2');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testContact', $tasks[0]->activityItems[0]->firstName);
     $this->assertEquals('Contact', get_class($tasks[0]->activityItems[0]));
     $this->assertEquals(1, $tasks[0]->completed);
     $this->assertEquals('2011-12-22 06:03', substr($tasks[0]->latestDateTime, 0, -3));
     $tasks = Task::getByName('task3');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testOpportunity', $tasks[0]->activityItems[0]->name);
     $this->assertEquals('Opportunity', get_class($tasks[0]->activityItems[0]));
     $this->assertNull($tasks[0]->completed);
     $this->assertEquals($actionDateTime, substr($tasks[0]->latestDateTime, 0, -3));
     //Confirm 10 rows were processed as 'created'.
     $this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::CREATED));
     //Confirm that 0 rows were processed as 'updated'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
     //Confirm 2 rows were processed as 'errors'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
     $beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
     $this->assertEquals(0, count($beansWithErrors));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:58,代码来源:TaskImportTest.php

示例2: find

 static function find($search_id)
 {
     $found_task = null;
     $tasks = Task::getAll();
     foreach ($tasks as $task) {
         $task_id = $task->getId();
         if ($task_id == $search_id) {
             $found_task = $task;
         }
     }
     return $found_task;
 }
开发者ID:r-hills,项目名称:todo_hw1,代码行数:12,代码来源:Task.php

示例3: test_deleteAll

 function test_deleteAll()
 {
     $description = "Wash the dog";
     $description2 = "Water the lawn";
     $test_Task = new Task($description);
     $test_Task->save();
     $test_Task2 = new Task($description2);
     $test_Task2->save();
     Task::deleteAll();
     $result = Task::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:bdspen,项目名称:todo_database,代码行数:12,代码来源:TaskTest.php

示例4: test_getAll

 function test_getAll()
 {
     //Arrange
     $description = "Wash the dog";
     $description2 = "Water the lawn";
     $test_task = new Task($description);
     $test_task->save();
     $test_task2 = new Task($description2);
     $test_task2->save();
     //Act
     $result = Task::getAll();
     //Assert
     $this->assertEquals([$test_task, $test_task2], $result);
 }
开发者ID:jcubed22,项目名称:ToDoList_DB,代码行数:14,代码来源:TaskTest.php

示例5: test_save

 function test_save()
 {
     //Arrange
     $name = "Home stuff";
     $id = null;
     $test_category = new Category($name, $id);
     $test_category->save();
     $due_date = "2015-10-12";
     $description = "Wash the dog";
     $category_id = $test_category->getId();
     $test_task = new Task($description, $due_date, $id, $category_id);
     //Act
     $test_task->save();
     //Assert
     $result = Task::getAll();
     var_dump($result);
     $this->assertEquals($test_task, $result[0]);
 }
开发者ID:r-hills,项目名称:To_Do_List,代码行数:18,代码来源:TaskTest.php

示例6: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $description = "Wash the dog";
     $due_date = '2015-01-01';
     $id = 1;
     $test_task = new Task($description, $id, $due_date);
     $test_task->save();
     $description2 = "Water the lawn";
     $id2 = 2;
     $due_date = '2015-01-02';
     $test_task2 = new Task($description2, $id, $due_date);
     $test_task2->save();
     //Act
     Task::deleteAll();
     //Asser
     $result = Task::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:bdspen,项目名称:todo_with_categories,代码行数:19,代码来源:TaskTest.php

示例7: test_deleteAll

 function test_deleteAll()
 {
     // Arrange
     $name = "Home stuff";
     $id = null;
     $test_category = new Category($name, $id);
     $description = "Wash the dog";
     $category_id = $test_category->getId();
     $test_task = new Task($description, $id, $category_id);
     $test_task->save();
     $description2 = "Water the lawn";
     $test_task2 = new Task($description2, $id, $category_id);
     $test_task2->save();
     // Act
     Task::deleteAll();
     // Assert
     $result = Task::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:alexMcosta,项目名称:todo_with_mysql,代码行数:19,代码来源:TaskTest.php

示例8: test_deleteAll

 function test_deleteAll()
 {
     $name = "Home stuff";
     $id = null;
     $test_category = new Category($name, $id);
     $test_category->save();
     $description = "Wash the dog";
     $date_due = "9/25/1990";
     $time_due = "9:00am";
     $category_id = $test_category->getId();
     $test_task = new Task($id, $description, $date_due, $time_due, $category_id);
     $test_task->save();
     $description2 = "Water the Lawn";
     $date_due2 = "3/28/2000";
     $time_due2 = "10:00am";
     $test_task2 = new Task($id, $description2, $date_due2, $time_due2, $category_id);
     $test_task2->save();
     Task::deleteAll();
     $result = Task::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:jlbethel,项目名称:To-Do,代码行数:21,代码来源:TaskTest.php

示例9: Task

// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
$pageTitle = 'Ofuz';
$Author = 'SQLFusion LLC';
$Keywords = 'Keywords for search engine';
$Description = 'Description for search engine';
$background_color = 'white';
include_once 'config.php';
include_once 'includes/ofuz_check_access.script.inc.php';
include_once 'includes/header.inc.php';
//    $do_notes = new ContactNotes($GLOBALS['conx']);
//    $do_contact = new Contact($GLOBALS['conx']);
//    $do_company = new Company($GLOBALS['conx']);
//    $do_task = new Task($GLOBALS['conx']);
//    $do_task_category = new TaskCategory($GLOBALS['conx']);
//    $do_contact_task = new Contact();
//    $do_notes->sessionPersistent("ContactNotesEditSave", "index.php", 3600);
$tmp_task = new Task();
$tmp_task_cat = new TaskCategory();
$tmp_task_update = new Task();
$tmp_task->getAll();
while ($tmp_task->next()) {
    if ($tmp_task->category) {
        $category = $tmp_task_cat->getTaskCategoryName($tmp_task->category);
        $tmp_task_update->tmpUpdateTaskCat($tmp_task->idtask, $category);
    }
}
?>
Hello
</body>
</html>
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:31,代码来源:update_task_category.php

示例10: testDeleteTask

 function testDeleteTask()
 {
     //Arrange
     $id = 1;
     $description = "Wash the dog";
     $date_due = "1990-12-11";
     $time_due = "09:00:00";
     $test_task = new Task($id, $description, $date_due, $time_due);
     $test_task->save();
     $id2 = 2;
     $description2 = "Water the lawn";
     $date_due2 = "1990-11-11";
     $time_due2 = "09:01:00";
     $test_task2 = new Task($id2, $description2, $date_due2, $time_due2);
     $test_task2->save();
     //Act
     $test_task->delete();
     //Assert
     $this->assertEquals([$test_task2], Task::getAll());
 }
开发者ID:jlbethel,项目名称:To-Do-Databases,代码行数:20,代码来源:TaskTest.php

示例11: checkTasks

 public function checkTasks()
 {
     TaskRunner::checkAndRunTasks(Task::getAll());
 }
开发者ID:e-tipalchuk,项目名称:cron-manager,代码行数:4,代码来源:TasksController.php

示例12: getDocuTasks

 /**
  * gets documentation sub tasks and folders of a task
  *
  */
 public static function getDocuTasks($project_id, $parent_task_id = NULL)
 {
     $tasks = array();
     $tmp_options = array('use_collapsed' => true, 'order_by' => 'order_id, i.id', 'parent_task' => $parent_task_id, 'status_min' => 0, 'status_max' => 100, 'project' => $project_id, 'category_in' => array(TCATEGORY_DOCU, TCATEGORY_FOLDER));
     foreach ($pages = Task::getAll($tmp_options) as $p) {
         ### filter only folders with docu ###
         if ($p->category == TCATEGORY_FOLDER) {
             $found_docu = $p->show_folder_as_documentation;
             foreach ($subtasks = $p->getSubtasksRecursive() as $subtask) {
                 if ($subtask->category == TCATEGORY_DOCU) {
                     $found_docu = true;
                     break;
                 }
             }
             if ($found_docu) {
                 $tasks[] = $p;
             }
         } else {
             $tasks[] = $p;
         }
     }
     return $tasks;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:27,代码来源:class_task.inc.php

示例13: print_automatic

 /**
  * print a complete list as html
  * - use filters
  * - use check list style (tree, list, grouped)
  * - check customization-values
  * - check sorting
  * - get objects from database
  *
  */
 public function print_automatic()
 {
     require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
     global $PH;
     if (!($this->active_block_function = $this->getBlockStyleFromCookie())) {
         $this->active_block_function = 'list';
     }
     $this->initOrderQueryOption();
     ### grouped view ###
     if ($this->active_block_function == 'grouped') {
         $this->group_by = get("blockstyle_{$PH->cur_page->id}_{$this->id}_grouping");
         /**
          * @@@ later use only once...
          *
          *   $this->columns= filterOptions($this->columns,"CURPAGE.BLOCKS[{$this->id}].STYLE[{$this->active_block_function}].COLUMNS");
          */
         if (isset($this->columns[$this->group_by])) {
             unset($this->columns[$this->group_by]);
         }
         ### prepend key to sorting ###
         if (isset($this->query_options['order_by'])) {
             $this->query_options['order_by'] = $this->groupings->getActiveFromCookie() . "," . $this->query_options['order_by'];
         } else {
             $this->query_options['order_by'] = $this->groupings->getActiveFromCookie();
         }
     }
     $versions = Task::getAll($this->query_options);
     $this->render_list($versions);
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:38,代码来源:list_versions.inc.php

示例14: ajaxUserTasks

function ajaxUserTasks()
{
    $q = asCleanString(getOnePassedId("q"));
    $prj = intval(getOnePassedId("prj"));
    if ($prj == 0) {
        $prj = NULL;
    }
    if ($q == "") {
        $q = NULL;
    }
    $tasks = Task::getAll(array('search' => $q, 'project' => $prj));
    $result = array();
    foreach ($tasks as $t) {
        $result[] = array('name' => $t->name, 'id' => $t->id);
    }
    echo json_encode($result);
}
开发者ID:Bremaweb,项目名称:streber-1,代码行数:17,代码来源:home_timetracking.inc.php

示例15: testSuperUserAllDefaultControllerActions

 public function testSuperUserAllDefaultControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $superAccountId2 = self::getModelIdByModelNameAndName('Account', 'superAccount2');
     $superContactId = self::getModelIdByModelNameAndName('Contact', 'superContact superContactson');
     $account = Account::getById($superAccountId);
     $account2 = Account::getById($superAccountId2);
     $contact = Contact::getById($superContactId);
     //confirm no existing activities exist
     $activities = Activity::getAll();
     $this->assertEquals(0, count($activities));
     //Test just going to the create from relation view.
     $this->setGetArray(array('relationAttributeName' => 'Account', 'relationModelId' => $superAccountId, 'relationModuleId' => 'accounts', 'redirectUrl' => 'someRedirect'));
     $this->runControllerWithNoExceptionsAndGetContent('tasks/default/createFromRelation');
     //add related task for account using createFromRelation action
     $activityItemPostData = array('Account' => array('id' => $superAccountId));
     $this->setGetArray(array('relationAttributeName' => 'Account', 'relationModelId' => $superAccountId, 'relationModuleId' => 'accounts', 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Task' => array('name' => 'myTask')));
     $this->runControllerWithRedirectExceptionAndGetContent('tasks/default/createFromRelation');
     //now test that the new task exists, and is related to the account.
     $tasks = Task::getAll();
     $this->assertEquals(1, count($tasks));
     $this->assertEquals('myTask', $tasks[0]->name);
     $this->assertEquals(1, $tasks[0]->activityItems->count());
     $activityItem1 = $tasks[0]->activityItems->offsetGet(0);
     $this->assertEquals($account, $activityItem1);
     //test viewing the existing task in a details view
     $this->setGetArray(array('id' => $tasks[0]->id));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('tasks/default/details');
     //test editing an existing task and saving. Add a second relation, to a contact.
     //First just go to the edit view and confirm it loads ok.
     $this->setGetArray(array('id' => $tasks[0]->id, 'redirectUrl' => 'someRedirect'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('tasks/default/edit');
     //Save changes via edit action.
     $activityItemPostData = array('Account' => array('id' => $superAccountId), 'Contact' => array('id' => $superContactId));
     $this->setGetArray(array('id' => $tasks[0]->id, 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Task' => array('name' => 'myTaskX')));
     $this->runControllerWithRedirectExceptionAndGetContent('tasks/default/edit');
     //Confirm changes applied correctly.
     $tasks = Task::getAll();
     $this->assertEquals(1, count($tasks));
     $this->assertEquals('myTaskX', $tasks[0]->name);
     $this->assertEquals(2, $tasks[0]->activityItems->count());
     $activityItem1 = $tasks[0]->activityItems->offsetGet(0);
     $activityItem2 = $tasks[0]->activityItems->offsetGet(1);
     $this->assertEquals($account, $activityItem1);
     $this->assertEquals($contact, $activityItem2);
     //Remove contact relation.  Switch account relation to a different account.
     $activityItemPostData = array('Account' => array('id' => $superAccountId2));
     $this->setGetArray(array('id' => $tasks[0]->id));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Task' => array('name' => 'myTaskX')));
     $this->runControllerWithRedirectExceptionAndGetContent('tasks/default/edit');
     //Confirm changes applied correctly.
     $tasks = Task::getAll();
     $this->assertEquals(1, count($tasks));
     $this->assertEquals('myTaskX', $tasks[0]->name);
     $this->assertEquals(1, $tasks[0]->activityItems->count());
     $activityItem1 = $tasks[0]->activityItems->offsetGet(0);
     $this->assertEquals($account2, $activityItem1);
     //test removing a task.
     $this->setGetArray(array('id' => $tasks[0]->id));
     $this->resetPostArray();
     $this->runControllerWithRedirectExceptionAndGetContent('tasks/default/delete');
     //Confirm no more tasks exist.
     $tasks = Task::getAll();
     $this->assertEquals(0, count($tasks));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:70,代码来源:TasksSuperUserWalkthroughTest.php


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