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


PHP Task::getEditableById方法代码示例

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


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

示例1: taskAjax

/**
* test function for development @ingroup pages
*
* the output of this function could be requested with jquery like:
*
*       $('#sideboard div').load('index.php?go=taskAjax',{
*        go: 'taskAjax',
*        tsk: id
*       });
*/
function taskAjax()
{
    if ($task_id = intval(get('tsk'))) {
        require_once "render/render_wiki.inc.php";
        ### headline ###
        $editable = false;
        # flag, if this task can be edited
        if ($task = Task::getEditableById($task_id)) {
            $editable = true;
        } else {
            if (!($task = Task::getVisibleById($task_id))) {
                echo "Failure";
                return;
            }
        }
        echo "<h3>" . asHtml($task->name) . "</h3>";
        echo wikifieldAsHtml($task, 'description');
    }
}
开发者ID:Bremaweb,项目名称:streber-1,代码行数:29,代码来源:task_ajax.inc.php

示例2: commentsMoveToFolder

/**
* move comments to folder...
*/
function commentsMoveToFolder()
{
    global $PH;
    $comment_ids = getPassedIds('comment', 'comments_*');
    if (!$comment_ids) {
        $PH->abortWarning(__("Select some comments to move"));
        return;
    }
    /**
     * if folder was given, directly move tasks...
     */
    $target_id = -1;
    # target is unknown
    $folder_ids = getPassedIds('folder', 'folders_*');
    if (count($folder_ids) == 1) {
        if ($folder_task = Task::getVisibleById($folder_ids[0])) {
            $target_id = $folder_task->id;
        }
    } else {
        if (get('from_selection')) {
            $target_id = 0;
            # to ungrout to root?
        }
    }
    if ($target_id != -1) {
        if ($target_id != 0) {
            if (!($target_task = Task::getEditableById($target_id))) {
                $PH->abortWarning(__("insufficient rights"));
            }
        }
        $count = 0;
        foreach ($comment_ids as $id) {
            if ($comment = Comment::getEditableById($id)) {
                $comment->task = $target_id;
                /**
                 * @@@ do we have to reset ->comment as well?
                 *
                 * this splits discussions into separate comments...
                 */
                $comment->comment = 0;
                $comment->update();
            } else {
                new FeedbackWarning(sprintf(__("Can not edit comment %s"), asHtml($comment->name)));
            }
        }
        ### return to from-page? ###
        if (!$PH->showFromPage()) {
            $PH->show('home');
        }
        exit;
    }
    /**
     * build page folder list to select target...
     */
    require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php';
    ### get project ####
    if (!($comment = Comment::getVisibleById($comment_ids[0]))) {
        $PH->abortWarning("could not get comment", ERROR_BUG);
    }
    if (!($project = Project::getVisibleById($comment->project))) {
        $PH->abortWarning("task without project?", ERROR_BUG);
    }
    $page = new Page(array('use_jscalendar' => false, 'autofocus_field' => 'company_name'));
    $page->cur_tab = 'projects';
    $page->type = __("Edit tasks");
    $page->title = $project->name;
    $page->title_minor = __("Select one folder to move comments into");
    $page->crumbs = build_project_crumbs($project);
    $page->options[] = new NaviOption(array('target_id' => 'commentsMoveToFolder'));
    echo new PageHeader();
    echo new PageContentOpen();
    echo __("... or select nothing to move to project root");
    ### write selected comments as hidden fields ###
    foreach ($comment_ids as $id) {
        if ($comment = Comment::getEditableById($id)) {
            echo "<input type=hidden name='comments_{$id}_chk' value='1'>";
        }
    }
    $list = new ListBlock_tasks();
    $list->reduced_header = true;
    $list->query_options['show_folders'] = true;
    $list->query_options['folders_only'] = true;
    $list->query_options['project'] = $project->id;
    $list->groupings = NULL;
    $list->block_functions = NULL;
    $list->id = 'folders';
    unset($list->columns['project']);
    unset($list->columns['status']);
    unset($list->columns['date_start']);
    unset($list->columns['days_left']);
    unset($list->columns['created_by']);
    unset($list->columns['label']);
    $list->no_items_html = __("No folders in this project...");
    $list->functions = array();
    $list->active_block_function = 'tree';
    $list->print_automatic($project);
    echo "<input type=hidden name='from_selection' value='1'>";
//.........这里部分代码省略.........
开发者ID:Bremaweb,项目名称:streber-1,代码行数:101,代码来源:comment.inc.php

示例3: __toString

 public function __toString()
 {
     global $PH;
     global $auth;
     #--- news -----------------------------------------------------------
     $comments = $this->item_with_comments->getComments(array('order_by' => 'created'));
     $block = new PageBlock(array('title' => sprintf(__("%s Comments"), count($comments) ? count($comments) : __("No", "As in... >No< Comments")), 'id' => 'news'));
     $block->render_blockStart();
     $count = 0;
     foreach ($comments as $c) {
         ### own comment
         $is_comment_editable = $auth->cur_user->user_rights & RIGHT_EDITALL || $c->created_by == $auth->cur_user->id;
         if (!($creator = Person::getVisibleById($c->created_by))) {
             continue;
         }
         echo "<div class='post_list_entry'>";
         echo "<h3>";
         if ($c->created_by == $auth->cur_user->id) {
             echo $creator->nickname;
         } else {
             echo $creator->getLink();
         }
         echo "<span class=separator>:</span>";
         echo asHtml($c->name);
         if ($new = $c->isChangedForUser()) {
             if ($new == 1) {
                 echo '<span class=new> (' . __('New') . ') </span>';
             } else {
                 echo '<span class=new>  (' . __('Updated') . ') </span>';
             }
         }
         echo "</h3>";
         echo "<p class= details>";
         echo renderTimeAgo($c->created);
         require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
         $versions = ItemVersion::getFromItem($c);
         if (count($versions) > 1) {
             echo " (" . $PH->getLink('itemViewDiff', sprintf(__("%s. update", "like in... Nth update"), count($versions)), array('item' => $c->id));
             echo " " . renderTimeAgo($c->modified);
             echo ") ";
         }
         if ($c->pub_level != PUB_LEVEL_OPEN) {
             echo ' - ' . sprintf(__("visible as %s"), renderPubLevelName($c->pub_level));
             ### publish ###
             if (($parent_task = Task::getEditableById($c->task)) && $c->pub_level < PUB_LEVEL_OPEN) {
                 echo " - " . $PH->getLink('itemsSetPubLevel', __('Publish'), array('item' => $c->id, 'item_pub_level' => PUB_LEVEL_OPEN));
             }
         }
         ### delete
         if ($is_comment_editable) {
             echo " - " . $PH->getLink('commentsDelete', __('Delete'), array('comment' => $c->id));
         }
         echo "</p>";
         if ($is_comment_editable) {
             echo wikifieldAsHtml($c, 'description');
         } else {
             echo wikifieldAsHtml($c, 'description', array('editable' => false));
         }
         echo "</div>";
         $c->nowViewedByUser();
     }
     $this->render_blockEnd();
     return '';
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:64,代码来源:comments_on_item_block.inc.php

示例4: render_tr

 function render_tr(&$obj, $style = "")
 {
     global $PH;
     global $auth;
     global $COMMENTTYPE_NAMES;
     if (!isset($obj) || !$obj instanceof Comment) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $style_cur_user = '';
     if ($obj->created_by != 0 && ($person = Person::getById($obj->created_by))) {
         if ($obj->created_by == $auth->cur_user->id) {
             $style_cur_user = 'by_cur_user';
         }
     }
     $column_poster = '<td class="details ' . $style_cur_user . '">';
     if ($obj->created_by != 0 && ($person = Person::getById($obj->created_by))) {
         $column_poster .= '<p class="poster">' . $person->getLink() . '</p>';
     }
     if (!$obj->view_collapsed) {
         ### time ###
         $p_time = renderDateHtml($obj->time);
         $column_poster .= "<span class=date>{$p_time}</span>";
         ### pub level if not open ###
         if ($obj->pub_level != PUB_LEVEL_OPEN) {
             global $g_pub_level_names;
             $column_poster .= "<br>(" . $g_pub_level_names[$obj->pub_level] . ')<br>';
         }
         require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
         $versions = ItemVersion::getFromItem($obj);
         if (count($versions) > 1) {
             $column_poster .= "<br>" . $PH->getLink('itemViewDiff', sprintf(__("version %s"), count($versions)), array('item' => $obj->id));
         }
         $column_poster .= "<div class=edit_functions>";
         # if current user is the creator of the comment
         if ($obj->created_by == $auth->cur_user->id) {
             if ($obj->isEditable()) {
                 $column_poster .= $PH->getLink('commentEdit', __('Edit'), array('comment' => $obj->id));
                 $column_poster .= $PH->getLink('commentsDelete', __('Delete'), array('comment' => $obj->id));
             }
         } else {
             ### check sufficient rights ###
             if ($parent_task = Task::getEditableById($obj->task)) {
                 # have to send the task-id otherwise the reply function doesn't work
                 $column_poster .= $PH->getLink('commentNew', __('Reply'), array('comment' => $obj->id, 'parent_task' => $obj->task));
                 if ($obj->pub_level != PUB_LEVEL_OPEN) {
                     $column_poster .= $PH->getLink('itemsSetPubLevel', __('Publish'), array('item' => $obj->id, 'item_pub_level' => PUB_LEVEL_OPEN));
                 }
             }
         }
         $column_poster .= "</div>";
     }
     $column_poster .= "</td>";
     print $column_poster;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:55,代码来源:list_comments.inc.php

示例5: taskNoteOnPersonEdit

/**
* Edit note on person
*
* @ingroup pages
*/
function taskNoteOnPersonEdit($task = NULL, $person = NULL)
{
    global $PH;
    global $auth;
    global $g_pub_level_names;
    global $g_prio_names;
    if (!$task) {
        $id = getOnePassedId('tsk');
        if (!($task = Task::getEditableById($id))) {
            $PH->abortWarning(__("Select a note to edit"), ERROR_NOTE);
            return;
        }
    }
    ## get person ##
    if (!$person) {
        $pid = getOnePassedId('person');
        if (!($person = Person::getById($pid))) {
            $PH->abortWarning(__("ERROR: could not get Person"), ERROR_NOTE);
            return;
        }
    }
    $page = new Page(array('use_jscalendar' => false, 'autofocus_field' => 'task_name'));
    $page->cur_tab = 'people';
    if ($person->id) {
        $page->crumbs = build_person_crumbs($person);
    }
    $page->crumbs[] = new NaviCrumb(array('target_id' => 'taskNoteOnPersonEdit'));
    $page->type = __("Note");
    if (!$task->id) {
        $page->title = __('Create new note');
        $page->title_minor = __('Edit');
        ## default title ##
        $date = gmdate("Y-m-d", time());
        $time = getGMTString();
        $dt = $date . " " . renderTime($time);
        $task->name = sprintf(__("New Note on %s, %s"), $person->name, $dt);
    }
    ## eventually needed later when note is a subcategory of task
    /*else {
          $page->title=$task->name;
          $page->title_minor=$task->short;
      }*/
    echo new PageHeader();
    echo new PageContentOpen();
    require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
    $form = new PageForm();
    $form->button_cancel = true;
    ## name field ##
    $form->add($task->fields['name']->getFormElement($task));
    ## description field ##
    $e = $task->fields['description']->getFormElement($task);
    $e->rows = 22;
    $form->add($e);
    ### public-level drop down menu ###
    $form->add(new Form_Dropdown('task_pub_level', __("Publish to", "Form label"), array_flip($g_pub_level_names), $task->pub_level));
    ## priority drop down menu##
    $form->add(new Form_Dropdown('task_prio', __("Prio", "Form label"), array_flip($g_prio_names), $task->prio));
    if ($task->id == 0) {
        $proj_select = 0;
    }
    $p_list = array();
    $count = 1;
    $p_projects = $person->getProjects();
    $num = count($p_projects);
    if ($num > 0) {
        $p_list[0] = __('Assigned Projects');
        foreach ($p_projects as $pp) {
            $p_list[$pp->id] = "- " . $pp->name;
            $count++;
        }
    }
    $p_companies = $person->getCompanies();
    $num = count($p_companies);
    if ($num > 0) {
        $p_list['-1'] = __('Company Projects');
        foreach ($p_companies as $pcs) {
            $c_id = $pcs->id;
            $c_projects = Project::getAll(array('company' => $c_id));
            $count2 = 0;
            foreach ($c_projects as $cp) {
                $p_list[$cp->id] = "- " . $cp->name;
            }
        }
    }
    if (!($projects = Project::getAll(array('order_by' => 'name ASC')))) {
    } else {
        $p_list['-2'] = __('All other Projects');
        foreach ($projects as $pj) {
            $p_list[$pj->id] = "- " . $pj->name;
        }
    }
    $form->add(new Form_Dropdown('project', __('For Project', 'form label'), array_flip($p_list), $proj_select, "id='proj_list'"));
    ## new project ##
    if ($task->id == 0) {
        $form->add(new Form_checkbox('new_project', __('New project', 'form label'), false, "id='proj_new_checkbox'"));
//.........这里部分代码省略.........
开发者ID:Bremaweb,项目名称:streber-1,代码行数:101,代码来源:task_more.inc.php

示例6: taskEditSubmit


//.........这里部分代码省略.........
            }
        }
        if ($requested_people) {
            new FeedbackMessage(sprintf(__('Requested feedback from: %s.'), join($requested_people, ", ")));
        }
    }
    ### only insert the comment, when comment name or description are valid
    if (get('comment_name') || get('comment_description')) {
        require_once confGet('DIR_STREBER') . 'pages/comment.inc.php';
        $valid_comment = true;
        ### new object? ###
        $comment = new Comment(array('name' => get('comment_name'), 'description' => get('comment_description'), 'project' => $task->project, 'task' => $task->id));
        validateNotSpam($comment->name . $comment->description);
        ### write to db ###
        if ($valid_comment) {
            if (!$comment->insert()) {
                new FeedbackWarning(__("Failed to add comment"));
            } else {
                ### change task update modification date ###
                if (isset($task)) {
                    ### Check if now longer new ###
                    if ($task->status == STATUS_NEW) {
                        global $auth;
                        if ($task->created < $auth->cur_user->last_login) {
                            $task->status = STATUS_OPEN;
                        }
                    }
                    $task->update(array('modified', 'status'));
                }
                $added_comment = true;
            }
        }
    }
    if ($task->id != 0 && !Task::getEditableById($task->id)) {
        if ($added_comment) {
            ### display taskView ####
            if (!$PH->showFromPage()) {
                $PH->show('home', array());
            }
            exit;
        } else {
            $PH->abortWarning(__("Not enough rights to edit task"));
        }
    }
    $task->validateEditRequestTime();
    $status_old = $task->status;
    # retrieve all possible values from post-data (with field->view_in_forms == true)
    # NOTE:
    # - this could be an security-issue.
    # @@@ TODO: as some kind of form-edit-behaviour to field-definition
    foreach ($task->fields as $f) {
        $name = $f->name;
        $f->parseForm($task);
    }
    $task->fields['parent_task']->parseForm($task);
    ### category ###
    $was_of_category = $task->category;
    if (!is_null($c = get('task_category'))) {
        global $g_tcategory_names;
        if (isset($g_tcategory_names[$c])) {
            $task->category = $c;
        } else {
            trigger_error("ignoring unknown task category '{$c}'", E_USER_NOTICE);
        }
    }
    /**
开发者ID:Bremaweb,项目名称:streber-1,代码行数:67,代码来源:task_edit.inc.php

示例7: render_tr

 function render_tr(&$task, $style = "")
 {
     global $PH;
     global $g_resolve_reason_names;
     if (!isset($task) || !is_object($task)) {
         trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $buffer = '';
     ### collapsed view ###
     $html_link = '<b>' . $task->getLink(false, false) . '</b>';
     if ($task->view_collapsed) {
         $buffer .= $PH->getLink('taskToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_closed.gif") . "\">", array('tsk' => $task->id), NULL, true) . $html_link;
     } else {
         $buffer .= $PH->getLink('taskToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_open.gif") . "\">", array('tsk' => $task->id), NULL, true) . $html_link . '<br>';
         $editable = false;
         if (Task::getEditableById($task->id)) {
             $editable = true;
         }
         $buffer .= "<div class=description>";
         $buffer .= wikifieldAsHtml($task, 'description');
         $buffer .= "</div>";
     }
     echo '<td>' . $buffer . '</td>';
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:25,代码来源:list_versions.inc.php

示例8: _getParentOfTaskId

function _getParentOfTaskId($task_id)
{
    global $PH;
    ### get path of target to check for cycles ###
    if ($task_id != 0) {
        if (!($task = Task::getEditableById($task_id))) {
            $PH->abortWarning(__("insufficient rights"));
        }
        $parents = $task->getFolder();
        $parents[] = $task;
    } else {
        $parents = array();
    }
    return $parents;
}
开发者ID:Bremaweb,项目名称:streber-1,代码行数:15,代码来源:task_move.inc.php

示例9: render_quickedit

 public function render_quickedit($task)
 {
     global $PH;
     $editable = false;
     ### make sure it's editable ###
     if (Task::getEditableById($task->id)) {
         $editable = true;
     } else {
         if (!Task::getVisibleById($task->id)) {
             return false;
         }
     }
     ### get parent project ####
     if (!($project = Project::getVisibleById($task->project))) {
         return;
     }
     $this->render_blockStart();
     require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
     global $REPRODUCIBILITY_VALUES;
     global $g_prio_names;
     global $g_status_names;
     $form = new PageForm();
     $form->button_cancel = false;
     $form->add($tab_group = new Page_TabGroup());
     $tab_group->add($tab = new Page_Tab("comment", __("Add comment")));
     ### Comment ###
     $comment_name = '';
     $comment = new Comment(array('id' => 0, 'name' => $comment_name));
     $tab->add($comment->fields['name']->getFormElement($comment, __('Comment')));
     $e = $comment->fields['description']->getFormElement($comment);
     $e->rows = 8;
     $tab->add($e);
     ### request feedback
     $tab->add(buildRequestFeedbackInput($project));
     ### update ###
     if ($editable && $task->isOfCategory(array(TCATEGORY_TASK, TCATEGORY_BUG))) {
         $tab_group->add($tab = new Page_Tab("update", __("Update")));
         #$tab->add(new Form_Dropdown('task_for_milestone', __('For Milestone'), $project->buildPlannedForMilestoneList(), $task->for_milestone));
         $tab->add(new Form_DropdownGrouped('task_for_milestone', __('For Milestone'), $project->buildPlannedForMilestoneList(), $task->for_milestone));
         $tab->add(new Form_DropdownGrouped('task_resolved_version', __('Resolved in'), $project->buildResolvedInList(), $task->resolved_version));
         global $g_resolve_reason_names;
         $tab->add(new Form_Dropdown('task_resolve_reason', __('Resolve reason'), array_flip($g_resolve_reason_names), $task->resolve_reason));
         ### for existing tasks, get already assigned
         if ($task->id) {
             $assigned_people = $task->getAssignedPeople();
         } else {
             trigger_error("view a task with zero id?");
         }
         $team = array(__('- select person -') => 0);
         ### create team-list ###
         foreach ($project->getPeople() as $p) {
             $team[$p->name] = $p->id;
         }
         ### create drop-down-lists ###
         $count_new = 0;
         $count_all = 0;
         if (isset($assigned_people)) {
             foreach ($assigned_people as $ap) {
                 if (!($p = Person::getVisibleById($ap->id))) {
                     continue;
                     # skip if invalid person
                 }
                 if ($task->id) {
                     $tab->add(new Form_Dropdown('task_assigned_to_' . $ap->id, __("Assigned to"), $team, $ap->id));
                 } else {
                     $tab->add(new Form_Dropdown('task_assign_to_' . $count_new, __("Assign to"), $team, $ap->id));
                     $count_new++;
                 }
                 $count_all++;
                 unset($team[$ap->name]);
             }
         }
         ### add empty drop-downlist for new assignments ###
         $str_label = $count_all == 0 ? __("Assign to", "Form label") : __("Also assign to", "Form label");
         $tab->add(new Form_Dropdown("task_assign_to_{$count_new}", $str_label, $team, 0));
         if (!$task->isMilestoneOrVersion()) {
             $tab->add(new Form_Dropdown('task_prio', __("Prio", "Form label"), array_flip($g_prio_names), $task->prio));
         }
         $ar = array(__('undefined') => 0, __('30 min') => 30 * 60, __('1 h') => 60 * 60, __('2 h') => 2 * 60 * 60, __('4 h') => 4 * 60 * 60, __('1 Day') => 1 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('2 Days') => 2 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('3 Days') => 3 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('4 Days') => 4 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('1 Week') => 1 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('2 Weeks') => 2 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('3 Weeks') => 3 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60);
         $tab->add(new Form_Dropdown('task_estimated', __("Estimated time"), $ar, $task->estimated));
         $tab->add(new Form_Dropdown('task_estimated_max', __("Estimated worst case"), $ar, $task->estimated_max));
         $ar = array(__('undefined') => -1, '0%' => 0, '10%' => 10, '20%' => 20, '30%' => 30, '40%' => 40, '50%' => 50, '60%' => 60, '70%' => 70, '80%' => 80, '90%' => 90, '95%' => 95, '98%' => 98, '99%' => 99, '100%' => 100);
         $tab->add(new Form_Dropdown('task_completion', __("Completed"), $ar, $task->completion));
         $tab->add($task->fields['parent_task']->getFormElement($task));
         $st = array();
         foreach ($g_status_names as $s => $n) {
             if ($s >= STATUS_NEW) {
                 $st[$s] = $n;
             }
         }
         if ($task->isMilestoneOrVersion()) {
             unset($st[STATUS_NEW]);
         }
         $tab->add(new Form_Dropdown('task_status', "Status", array_flip($st), $task->status));
     }
     /**
      * to reduce spam, enforce captcha test for guests
      */
     global $auth;
     if ($auth->cur_user->id == confGet('ANONYMOUS_USER')) {
//.........这里部分代码省略.........
开发者ID:Bremaweb,项目名称:streber-1,代码行数:101,代码来源:task_view.inc.php

示例10: FilesMoveToFolder

/**
* move files to folder...
*
* NOTE: this works either...
* - directly by passing a target folder in 'folder' or 'folders_*'
* - in two steps, whereas
*   - the passed task-ids are keept as hidden fields,
*   - a list with folders is been rendered
*   - a flag 'from_selection' is set
*   - after submit, the kept tasks are moved to 'folders_*'
*
*/
function FilesMoveToFolder()
{
    global $PH;
    $file_ids = getPassedIds('file', 'files_*');
    if (!$file_ids) {
        $PH->abortWarning(__("Select some files to move"));
        exit;
    }
    /**
     * by default render list of folders...
     */
    $target_id = -1;
    /**
     * ...but, if folder was given, directly move files...
     */
    $folder_ids = getPassedIds('folder', 'folders_*');
    if (count($folder_ids) == 1) {
        if ($folder_task = Task::getVisibleById($folder_ids[0])) {
            $target_id = $folder_task->id;
        }
    } else {
        if (get('from_selection')) {
            $target_id = 0;
        }
    }
    if ($target_id != -1) {
        if ($target_id != 0) {
            if (!($target_task = Task::getEditableById($target_id))) {
                $PH->abortWarning(__("insufficient rights"));
            }
            ### get path of target to check for cycles ###
            $parent_tasks = $target_task->getFolder();
            $parent_tasks[] = $target_task;
        } else {
            $parent_tasks = array();
        }
        $count = 0;
        foreach ($file_ids as $id) {
            if ($file = File::getEditableById($id)) {
                $file->parent_item = $target_id;
                $file->update();
            } else {
                $PH->messages[] = sprintf(__("Can not edit file %s"), $file->name);
            }
        }
        ### return to from-page? ###
        if (!$PH->showFromPage()) {
            $PH->show('home');
        }
        exit;
    }
    #else if($target_id != -1) {
    #    $PH->abortWarning(__("insufficient rights to edit any of the selected items"));
    #}
    /**
     * build page folder lists...
     */
    ### get project ####
    if (!($file = File::getVisibleById($file_ids[0]))) {
        $PH->abortWarning("could not get file", ERROR_BUG);
    }
    if (!($project = Project::getVisibleById($file->project))) {
        $PH->abortWarning("file without project?", ERROR_BUG);
    }
    $page = new Page(array('use_jscalendar' => false, 'autofocus_field' => 'company_name'));
    $page->cur_tab = 'projects';
    $page->type = __("Edit files");
    $page->title = "{$project->name}";
    $page->title_minor = __("Select folder to move files into");
    $page->crumbs = build_project_crumbs($project);
    $page->options[] = new NaviOption(array('target_id' => 'filesMoveToFolder'));
    echo new PageHeader();
    echo new PageContentOpen();
    ### write files as hidden entry ###
    foreach ($file_ids as $id) {
        if ($file = File::getEditableById($id)) {
            echo "<input type=hidden name='files_{$id}_chk' value='1'>";
        }
    }
    require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php';
    $list = new ListBlock_tasks();
    $list->query_options['show_folders'] = true;
    #$list->query_options['folders_only']= true;
    $list->query_options['project'] = $project->id;
    $list->groupings = NULL;
    $list->block_functions = NULL;
    $list->id = 'folders';
    $list->no_items_html = __('No folders available');
//.........这里部分代码省略.........
开发者ID:Bremaweb,项目名称:streber-1,代码行数:101,代码来源:file.inc.php


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