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


PHP testplan::delete方法代码示例

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


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

示例1: delete

 /**
  * delete test project from system, deleting all dependent data:
  *      keywords, requirements, custom fields, testsuites, testplans,
  *      testcases, results, testproject related roles,
  * 
  * @param integer $id test project id
  * @return integer status
  * 
  */
 function delete($id)
 {
     $debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
     $ret['msg'] = 'ok';
     $ret['status_ok'] = 1;
     $error = '';
     $reqspec_mgr = new requirement_spec_mgr($this->db);
     //
     // Notes on delete related to Foreing Keys
     // All link tables has to be deleted first
     //
     // req_relations
     //
     // testplan_tcversions
     // testplan_platforms
     // object_keywords
     // user_assignments
     // builds
     // milestones
     //
     // testplans
     // keywords
     // platforms
     // attachtments
     // testcases
     // testsuites
     // inventory
     //
     // testproject
     $this->deleteKeywords($id);
     $this->deleteAttachments($id);
     $reqSpecSet = $reqspec_mgr->get_all_in_testproject($id);
     if (!is_null($reqSpecSet) && count($reqSpecSet) > 0) {
         foreach ($reqSpecSet as $reqSpec) {
             $reqspec_mgr->delete_deep($reqSpec['id']);
         }
     }
     $tplanSet = $this->get_all_testplans($id);
     if (!is_null($tplanSet) && count($tplanSet) > 0) {
         $tplan_mgr = new testplan($this->db);
         $items = array_keys($tplanSet);
         foreach ($items as $key) {
             $tplan_mgr->delete($key);
         }
     }
     $platform_mgr = new tlPlatform($this->db, $id);
     $platform_mgr->deleteByTestProject($id);
     $a_sql[] = array("/* {$debugMsg} */ UPDATE {$this->tables['users']}  " . " SET default_testproject_id = NULL " . " WHERE default_testproject_id = {$id}", 'info_resetting_default_project_fails');
     // BUGID 3464
     $inventory_mgr = new tlInventory($id, $this->db);
     $invOpt = array('detailLevel' => 'minimun', 'accessKey' => 'id');
     $inventorySet = $inventory_mgr->getAll($invOpt);
     if (!is_null($inventorySet)) {
         foreach ($inventorySet as $key => $dummy) {
             $inventory_mgr->deleteInventory($key);
         }
     }
     foreach ($a_sql as $oneSQL) {
         if (empty($error)) {
             $sql = $oneSQL[0];
             $result = $this->db->exec_query($sql);
             if (!$result) {
                 $error .= lang_get($oneSQL[1]);
             }
         }
     }
     if ($this->deleteUserRoles($id) < tl::OK) {
         $error .= lang_get('info_deleting_project_roles_fails');
     }
     // ---------------------------------------------------------------------------------------
     // delete product itself and items directly related to it like:
     // custom fields assignments
     // custom fields values ( right now we are not using custom fields on test projects)
     // attachments
     if (empty($error)) {
         $sql = "/* {$debugMsg} */ DELETE FROM {$this->tables['cfield_testprojects']} WHERE testproject_id = {$id} ";
         $this->db->exec_query($sql);
         $sql = "/* {$debugMsg} */ DELETE FROM {$this->object_table} WHERE id = {$id}";
         $result = $this->db->exec_query($sql);
         if ($result) {
             $tproject_id_on_session = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : $id;
             if ($id == $tproject_id_on_session) {
                 $this->setSessionProject(null);
             }
         } else {
             $error .= lang_get('info_product_delete_fails');
         }
     }
     if (empty($error)) {
         // BUGID 3147 - Delete test project with requirements defined crashed with memory exhausted
         $this->tree_manager->delete_subtree_objects($id, $id, '', array('testcase' => 'exclude_tcversion_nodes'));
//.........这里部分代码省略.........
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:101,代码来源:testproject.class.php

示例2: logAuditEvent

$gui->cfields = $tplan_mgr->html_table_of_custom_field_inputs($args->tplan_id, $args->tproject_id);
switch ($args->do_action) {
    case 'edit':
        $tplanInfo = $tplan_mgr->get_by_id($args->tplan_id);
        if (sizeof($tplanInfo)) {
            $of->Value = $tplanInfo['notes'];
            $gui->testplan_name = $tplanInfo['name'];
            $gui->is_active = $tplanInfo['active'];
            $gui->is_public = $tplanInfo['is_public'];
            $gui->tplan_id = $args->tplan_id;
        }
        break;
    case 'do_delete':
        $tplanInfo = $tplan_mgr->get_by_id($args->tplan_id);
        if ($tplanInfo) {
            $tplan_mgr->delete($args->tplan_id);
            logAuditEvent(TLS("audit_testplan_deleted", $args->tproject_name, $tplanInfo['name']), "DELETE", $args->tplan_id, "testplan");
        }
        //unset the session test plan if it is deleted
        if (isset($_SESSION['testplanID']) && ($_SESSION['testplanID'] = $args->tplan_id)) {
            $_SESSION['testplanID'] = 0;
            $_SESSION['testplanName'] = null;
        }
        break;
    case 'do_update':
        $of->Value = $args->notes;
        $gui->testplan_name = $args->testplan_name;
        $gui->is_active = $args->active == 'on' ? 1 : 0;
        $gui->is_public = $args->is_public == 'on' ? 1 : 0;
        $template = 'planEdit.tpl';
        $status_ok = false;
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:planEdit.php


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