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


PHP Jobs::addJobProjectAssociation方法代码示例

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


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

示例1: createSideTaskProject

 /**
  * @param string $projectName
  * @return int $projectId
  */
 public function createSideTaskProject($projectName)
 {
     $sideTaskProjectType = Project::type_sideTaskProject;
     $projectid = Project::createSideTaskProject($projectName);
     if (-1 != $projectid) {
         // add new SideTaskProj to the team
         $query = "INSERT INTO `codev_team_project_table` (`project_id`, `team_id`, `type`) " . "VALUES ('{$projectid}','{$this->id}','{$sideTaskProjectType}');";
         $result = SqlWrapper::getInstance()->sql_query($query);
         if (!$result) {
             echo "<span style='color:red'>ERROR: Query FAILED</span>";
             exit;
         }
     } else {
         self::$logger->error("team {$this->name} createSideTaskProject !!!");
         echo "<span style='color:red'>ERROR: team {$this->name} createSideTaskProject !!!</span>";
         exit;
     }
     // assign SideTaskProject specific Job
     #REM: 'N/A' job_id = 1, created by SQL file
     Jobs::addJobProjectAssociation($projectid, Jobs::JOB_NA);
     return $projectid;
 }
开发者ID:fg-ok,项目名称:codev,代码行数:26,代码来源:team.class.php

示例2: createExternalTasksProject

 /**
  * Create project, categories & assign N/A job
  * @static
  * @param $projectName
  * @return int|string
  */
 public static function createExternalTasksProject($projectName, $projectDesc)
 {
     // check if name exists
     $query = "SELECT id FROM `mantis_project_table` WHERE name='{$projectName}'";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     $projectid = 0 != SqlWrapper::getInstance()->sql_num_rows($result) ? SqlWrapper::getInstance()->sql_result($result, 0) : -1;
     if (-1 != $projectid) {
         self::$logger->error("createExternalTasksProject({$projectName}): Project name already exist");
         return $projectid;
     }
     // create new Project
     $query = "INSERT INTO `mantis_project_table` (`name`, `status`, `enabled`, `view_state`, `access_min`, `description`, `category_id`, `inherit_global`) " . "VALUES ('{$projectName}',50,1,50,10,'{$projectDesc}',1,1);";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     $projectid = SqlWrapper::getInstance()->sql_insert_id();
     // when creating an new issue, the status is set to 'closed' (External Tasks have no workflow...)
     #REM first call to this function is in install step1, and $statusNames is set in step2. '90' is mantis default value for 'closed'
     $statusNames = NULL;
     # Constants::$statusNames;
     $status_closed = NULL != $statusNames ? array_search('closed', $statusNames) : 90;
     $query = "INSERT INTO `mantis_config_table` (`config_id`,`project_id`,`user_id`,`access_reqd`,`type`,`value`) " . "VALUES ('bug_submit_status', {$projectid}, 0, 90, 1, '{$status_closed}');";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     // Status to set auto-assigned issues to 'closed'
     $query = "INSERT INTO `mantis_config_table` (`config_id`,`project_id`,`user_id`,`access_reqd`,`type`,`value`) " . "VALUES ('bug_assigned_status', {$projectid}, 0, 90, 1, '{$status_closed}');";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     // create leave category
     $query = "INSERT INTO `mantis_category_table`  (`project_id`, `user_id`, `name`, `status`) " . "VALUES ('{$projectid}','0','Leave', '0');";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     $catLeaveId = SqlWrapper::getInstance()->sql_insert_id();
     // create otherInternal category
     $query = "INSERT INTO `mantis_category_table`  (`project_id`, `user_id`, `name`, `status`) " . "VALUES ('{$projectid}','0','Other activity', '0');";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     $catOtherInternalId = SqlWrapper::getInstance()->sql_insert_id();
     // --- update ExternalTasksProject in codev_config_table
     Config::getInstance()->setValue(Config::id_externalTasksProject, $projectid, Config::configType_int, $projectDesc);
     Config::getInstance()->setValue(Config::id_externalTasksCat_leave, $catLeaveId, Config::configType_int);
     Config::getInstance()->setValue(Config::id_externalTasksCat_otherInternal, $catOtherInternalId, Config::configType_int);
     // --- assign ExternalTasksProject specific Job
     #REM: 'N/A' job_id = 1, created by SQL file
     Jobs::addJobProjectAssociation($projectid, Jobs::JOB_NA);
     return $projectid;
 }
开发者ID:dfuzeau,项目名称:codev,代码行数:71,代码来源:project.class.php


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