本文整理汇总了PHP中Tasks::setTasksTypeId方法的典型用法代码示例。如果您正苦于以下问题:PHP Tasks::setTasksTypeId方法的具体用法?PHP Tasks::setTasksTypeId怎么用?PHP Tasks::setTasksTypeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tasks
的用法示例。
在下文中一共展示了Tasks::setTasksTypeId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeXlsTasksImport
public function executeXlsTasksImport(sfWebRequest $request)
{
app::setPageTitle('Import Spreadsheet', $this->getResponse());
if ($request->isMethod(sfRequest::PUT)) {
if ($request->hasParameter('import_file')) {
if (is_file($import_spreadsheet_file = sfConfig::get('sf_upload_dir') . '/' . $request->getParameter('import_file'))) {
$import_fields = $this->getUser()->getAttribute('import_fields');
$data = new Spreadsheet_Excel_Reader($import_spreadsheet_file);
$projects_id = $request->getParameter('projects_id');
if ($request->getParameter('import_first_row') == 1) {
$first_row = 1;
} elseif ($data->rowcount() > 2) {
$first_row = 2;
} else {
$first_row = 1;
}
for ($i = $first_row; $i <= $data->rowcount(); $i++) {
$t = new Tasks();
$t->setCreatedBy($this->getUser()->getAttribute('id'))->setCreatedAt(date('Y-m-d H:i:s'))->setProjectsId($request->getParameter('projects_id'));
$extra_fields = array();
for ($j = 1; $j <= $data->colcount(); $j++) {
if (isset($import_fields[$j])) {
$v = $data->val($i, $j);
if (strlen(trim($v)) == 0) {
continue;
}
switch ($import_fields[$j]) {
case 'TasksGroups':
if ($id = app::getProjectCfgItemIdByName($v, 'TasksGroups', $projects_id)) {
$t->setTasksGroupsId($id);
} else {
$cfg = new TasksGroups();
$cfg->setName($v);
$cfg->setProjectsId($projects_id);
$cfg->save();
$t->setTasksGroupsId($cfg->getId());
}
break;
case 'Versions':
if ($id = app::getProjectCfgItemIdByName($v, 'Versions', $projects_id)) {
$t->setVersionsId($id);
} else {
$cfg = new Versions();
$cfg->setName($v);
$cfg->setProjectsId($projects_id);
$cfg->save();
$t->setVersionsId($cfg->getId());
}
break;
case 'ProjectsPhases':
if ($id = app::getProjectCfgItemIdByName($v, 'ProjectsPhases', $projects_id)) {
$t->setProjectsPhasesId($id);
} else {
$cfg = new ProjectsPhases();
$cfg->setName($v);
$cfg->setProjectsId($projects_id);
$cfg->save();
$t->setProjectsPhasesId($cfg->getId());
}
break;
case 'TasksPriority':
if ($id = app::getCfgItemIdByName($v, 'TasksPriority')) {
$t->setTasksPriorityId($id);
} else {
$cfg = new TasksPriority();
$cfg->setName($v);
$cfg->save();
$t->setTasksPriorityId($cfg->getId());
}
break;
case 'TasksLabels':
if ($id = app::getCfgItemIdByName($v, 'TasksLabels')) {
$t->setTasksLabelId($id);
} else {
$cfg = new TasksLabels();
$cfg->setName($v);
$cfg->save();
$t->setTasksLabelId($cfg->getId());
}
break;
case 'name':
$t->setName($v);
break;
case 'TasksStatus':
if ($id = app::getCfgItemIdByName($v, 'TasksStatus')) {
$t->setTasksStatusId($id);
} else {
$cfg = new TasksStatus();
$cfg->setName($v);
$cfg->save();
$t->setTasksStatusId($cfg->getId());
}
break;
case 'TasksTypes':
if ($id = app::getCfgItemIdByName($v, 'TasksTypes')) {
$t->setTasksTypeId($id);
} else {
$cfg = new TasksTypes();
$cfg->setName($v);
$cfg->save();
//.........这里部分代码省略.........