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


PHP Comment::getVisibleById方法代码示例

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


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

示例1: renderLinkFromItemId

 /**
  * tries to build a valid a href-link to an item.
  *
  * - uses $this->name
  * - sets -this-html
  * - does all the neccessary security checks, styles and conversions
  */
 static function renderLinkFromItemId($target_id, $name = "")
 {
     global $PH;
     $target_id = intval($target_id);
     $html = "";
     if (!($item = DbProjectItem::getVisibleById($target_id))) {
         $html = '<em>' . sprintf(__("Unkwown item %s"), $target_id) . '</em>';
     } else {
         switch ($item->type) {
             case ITEM_TASK:
                 if ($task = Task::getVisibleById($item->id)) {
                     $style_isdone = $task->status >= STATUS_COMPLETED ? 'isDone' : '';
                     if ($name) {
                         $html = $PH->getLink('taskView', $name, array('tsk' => $task->id), $style_isdone, true);
                     } else {
                         $html = $task->getLink(false);
                     }
                 }
                 break;
             case ITEM_FILE:
                 require_once confGet('DIR_STREBER') . "db/class_file.inc.php";
                 if ($file = File::getVisibleById($item->id)) {
                     if ($name) {
                         $html = $PH->getLink('fileDownloadAsImage', $name, array('file' => $file->id), NULL, true);
                     } else {
                         $html = $PH->getLink('fileDownloadAsImage', $file->name, array('file' => $file->id));
                     }
                 }
                 break;
             case ITEM_COMMENT:
                 require_once confGet('DIR_STREBER') . "db/class_comment.inc.php";
                 if ($comment = Comment::getVisibleById($item->id)) {
                     if ($name) {
                         $html = $PH->getLink('commentView', $name, array('comment' => $comment->id), NULL, true);
                     } else {
                         $html = $PH->getLink('commentView', $comment->name, array('comment' => $comment->id));
                     }
                 }
                 break;
             case ITEM_PERSON:
                 if ($person = Person::getVisibleById($item->id)) {
                     if ($name) {
                         $html = $PH->getLink('personView', $name, array('person' => $person->id), NULL, true);
                     } else {
                         $html = $PH->getLink('personView', $person->name, array('person' => $person->id));
                     }
                 }
                 break;
             case ITEM_PROJECT:
                 if ($project = Project::getVisibleById($item->id)) {
                     if ($name == "") {
                         $name = asHtml($project->name);
                     }
                     $html = $PH->getLink('projView', $name, array('prj' => $project->id), NULL, true);
                 }
                 break;
             default:
                 $html = '<em>' . sprintf(__('Cannot link to item #%s of type %s'), intval($target_id), $item->type) . '</em>';
                 break;
         }
     }
     return $html;
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:70,代码来源:render_wiki.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: render_tr

 function render_tr(&$item, $style = "")
 {
     global $PH;
     $str_url = "";
     $str_name = "";
     $str_addon = "";
     $isDone = "";
     $html_details = "";
     $link = "";
     if ($type = $item->type) {
         switch ($type) {
             case ITEM_TASK:
                 require_once "db/class_task.inc.php";
                 if ($task = Task::getVisibleById($item->id)) {
                     $str_name = asHtml($task->name);
                     $str_url = $PH->getUrl('taskView', array('tsk' => $task->id));
                     if ($task->status >= STATUS_COMPLETED) {
                         $isDone = "class=isDone";
                     }
                     if ($prj = Project::getVisibleById($task->project)) {
                         $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id));
                         $html_details .= __('in', 'very short for IN folder...') . ' ' . $link;
                         if ($tmp = $task->getFolderLinks()) {
                             $html_details .= ' > ' . $tmp;
                         }
                     }
                 }
                 break;
             case ITEM_COMMENT:
                 require_once "db/class_comment.inc.php";
                 if ($comment = Comment::getVisibleById($item->id)) {
                     $str_name = asHtml($comment->name);
                     if ($comment->comment) {
                         $str_url = $PH->getUrl('taskView', array('tsk' => $comment->task));
                         $str_addon = __("(on comment)");
                     } else {
                         if ($comment->task) {
                             $str_url = $PH->getUrl('taskView', array('tsk' => $comment->task));
                             $str_addon = __("(on task)");
                         } else {
                             $str_url = $PH->getUrl('projView', array('prj' => $comment->project));
                             $str_addon = __("(on project)");
                         }
                     }
                 }
                 break;
             case ITEM_PERSON:
                 require_once "db/class_person.inc.php";
                 if ($person = Person::getVisibleById($item->id)) {
                     $str_name = asHtml($person->name);
                     $str_url = $PH->getUrl('personView', array('person' => $person->id));
                 }
                 break;
             case ITEM_EFFORT:
                 require_once "db/class_effort.inc.php";
                 if ($e = Effort::getVisibleById($item->id)) {
                     $str_name = asHtml($e->name);
                     $str_url = $PH->getUrl('effortEdit', array('effort' => $e->id));
                 }
                 if ($prj = Project::getVisibleById($e->project)) {
                     $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id));
                     $html_details .= __('in', 'very short for IN folder...') . ' ' . $link;
                 }
                 break;
             case ITEM_FILE:
                 require_once "db/class_file.inc.php";
                 if ($f = File::getVisibleById($item->id)) {
                     $str_name = asHtml($f->org_filename);
                     $str_url = $PH->getUrl('fileView', array('file' => $f->id));
                     if ($f->status >= STATUS_COMPLETED) {
                         $isDone = "class=isDone";
                     }
                     if ($prj = Project::getVisibleById($f->project)) {
                         $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id));
                         $html_details .= __('in', 'very short for IN folder...') . ' ' . $link;
                     }
                 }
                 break;
             case ITEM_PROJECT:
                 require_once "db/class_project.inc.php";
                 if ($prj = Project::getVisibleById($item->id)) {
                     $str_name = asHtml($prj->name);
                     $str_url = $PH->getUrl('projView', array('prj' => $prj->id));
                     if ($prj->status >= STATUS_COMPLETED) {
                         $isDone = "class=isDone";
                     }
                 }
                 break;
             case ITEM_COMPANY:
                 require_once "db/class_company.inc.php";
                 if ($c = Company::getVisibleById($item->id)) {
                     $str_name = asHtml($c->name);
                     $str_url = $PH->getUrl('companyView', array('company' => $c->id));
                 }
                 break;
             case ITEM_VERSION:
                 require_once "db/class_task.inc.php";
                 if ($tsk = Task::getVisibleById($item->id)) {
                     $str_name = asHtml($tsk->name);
                     $str_url = $PH->getUrl('taskView', array('tsk' => $tsk->id));
//.........这里部分代码省略.........
开发者ID:Bremaweb,项目名称:streber-1,代码行数:101,代码来源:list_bookmarks.inc.php

示例4: getObjectById

 /**
  * returns visible object of correct type by an itemId
  *
  * this is useful, eg. if you when to access common parameters like name,
  * regardless of the object's type.
  *
  * DbProjectItem::getById() would only load to basic fields. Getting the
  * complete date required check for type.
  *
  * @NOTE: This function causes a awkward dependency to classes derived from
  * DbProjectItem. It's somehow weird, that this method is placed inside the
  * parent class.
  */
 public static function getObjectById($id)
 {
     $id = intval($id);
     if (!($item = DbProjectItem::getById($id))) {
         return NULL;
     }
     if ($type = $item->type) {
         switch ($type) {
             case ITEM_TASK:
                 require_once "db/class_task.inc.php";
                 $item_full = Task::getVisibleById($item->id);
                 break;
             case ITEM_COMMENT:
                 require_once "db/class_comment.inc.php";
                 $item_full = Comment::getVisibleById($item->id);
                 break;
             case ITEM_PERSON:
                 require_once "db/class_person.inc.php";
                 $item_full = Person::getVisibleById($item->id);
                 break;
             case ITEM_EFFORT:
                 require_once "db/class_effort.inc.php";
                 $item_full = Effort::getVisibleById($item->id);
                 break;
             case ITEM_FILE:
                 require_once "db/class_file.inc.php";
                 $item_full = File::getVisibleById($item->id);
                 break;
             case ITEM_PROJECT:
                 require_once "db/class_project.inc.php";
                 $item_full = Project::getVisibleById($item->id);
                 break;
             case ITEM_COMPANY:
                 require_once "db/class_company.inc.php";
                 $item_full = Company::getVisibleById($item->id);
                 break;
             case ITEM_VERSION:
                 require_once "db/class_task.inc.php";
                 $item_full = Task::getVisibleById($item->id);
                 break;
             default:
                 $item_full = NULL;
         }
         return $item_full;
     }
 }
开发者ID:Bremaweb,项目名称:streber-1,代码行数:59,代码来源:db_item.inc.php

示例5: itemBookmarkEditMultiple

/**
* edit several bookmarks @ingroup pages
*/
function itemBookmarkEditMultiple($thebookmarks = NULL)
{
    global $PH;
    global $auth;
    global $g_notitychange_period;
    $is_already_bookmark = array();
    $bookmarks = array();
    $items = array();
    $edit_fields = array('notify_if_unchanged', 'notify_on_change');
    $different_fields = array();
    # hash containing fieldnames which are different in bookmarks
    if (!$thebookmarks) {
        $item_ids = getPassedIds('bookmark', 'bookmarks_*');
        foreach ($item_ids as $is) {
            if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id))) {
                if ($item = DbProjectItem::getById($bookmark[0]->item)) {
                    $bookmarks[] = $bookmark[0];
                    $items[] = $item;
                    $is_already_bookmark[$bookmark[0]->id] = true;
                }
            }
        }
    } else {
        $item_ids = $thebookmarks;
        foreach ($item_ids as $is) {
            if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 0))) {
                if ($item = DbProjectItem::getById($bookmark[0]->item)) {
                    $bookmarks[] = $bookmark[0];
                    $items[] = $item;
                    $is_already_bookmark[$bookmark[0]->id] = false;
                }
            } elseif ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1))) {
                if ($item = DbProjectItem::getById($bookmark[0]->item)) {
                    $bookmarks[] = $bookmark[0];
                    $items[] = $item;
                    $is_already_bookmark[$bookmark[0]->id] = true;
                }
            } else {
                $date = getGMTString();
                $bookmark = new ItemPerson(array('id' => 0, 'item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1, 'notify_if_unchanged' => 0, 'notify_on_change' => 0, 'created' => $date));
                if ($item = DbProjectItem::getById($is)) {
                    $bookmarks[] = $bookmark;
                    $items[] = $item;
                    $is_already_bookmark[$bookmark->id] = false;
                }
            }
        }
    }
    if (!$items) {
        $PH->abortWarning(__("Please select some items"));
    }
    $page = new Page();
    $page->cur_tab = 'home';
    $page->options = array(new NaviOption(array('target_id' => 'itemBookmarkEdit', 'name' => __('Edit bookmarks'))));
    $page->type = __('Edit multiple bookmarks', 'page title');
    $page->title = sprintf(__('Edit %s bookmark(s)'), count($items));
    $page->title_minor = __('Edit');
    echo new PageHeader();
    echo new PageContentOpen();
    echo "<ol>";
    foreach ($items as $item) {
        ## get item name ##
        $str_link = '';
        if ($type = $item->type) {
            switch ($type) {
                case ITEM_TASK:
                    require_once "db/class_task.inc.php";
                    if ($task = Task::getVisibleById($item->id)) {
                        $str_link = $task->getLink(false);
                    }
                    break;
                case ITEM_COMMENT:
                    require_once "db/class_comment.inc.php";
                    if ($comment = Comment::getVisibleById($item->id)) {
                        $str_link = $comment->getLink(false);
                    }
                    break;
                case ITEM_PERSON:
                    require_once "db/class_person.inc.php";
                    if ($person = Person::getVisibleById($item->id)) {
                        $str_link = $person->getLink(false);
                    }
                    break;
                case ITEM_EFFORT:
                    require_once "db/class_effort.inc.php";
                    if ($e = Effort::getVisibleById($item->id)) {
                        $str_link = $e->getLink(false);
                    }
                    break;
                case ITEM_FILE:
                    require_once "db/class_file.inc.php";
                    if ($f = File::getVisibleById($item->id)) {
                        $str_link = $f->getLink(false);
                    }
                    break;
                case ITEM_PROJECT:
                    require_once "db/class_project.inc.php";
//.........这里部分代码省略.........
开发者ID:Bremaweb,项目名称:streber-1,代码行数:101,代码来源:bookmark.inc.php

示例6: render_tr

 function render_tr(&$obj, $style = "")
 {
     global $PH;
     $str_url = "";
     $str_name = "";
     $str_addon = "";
     switch ($obj->type) {
         case ITEM_PROJECT:
             if ($project = Project::getVisibleById($obj->id)) {
                 $str_name = asHtml($project->name);
                 $str_url = $PH->getUrl('projView', array('prj' => $project->id));
             }
             break;
         case ITEM_TASK:
             if ($task = Task::getVisibleById($obj->id)) {
                 $str_name = asHtml($task->name);
                 $str_url = $PH->getUrl('taskView', array('tsk' => $task->id));
                 if ($project = Project::GetVisibleById($task->project)) {
                     $str_addon = "(" . $project->getLink(false) . ")";
                 }
             }
             break;
         case ITEM_COMMENT:
             if ($comment = Comment::getVisibleById($obj->id)) {
                 if ($comment->name == '') {
                     $str_name = "-";
                 } else {
                     $str_name = asHtml($comment->name);
                 }
                 $str_url = $PH->getUrl('taskView', array('tsk' => $comment->task));
                 $str_addon .= "(";
                 if ($task = Task::getVisibleById($comment->task)) {
                     if ($project = Project::getVisibleById($task->project)) {
                         $str_addon .= $project->getLink(false) . " > ";
                     }
                     $str_addon .= $task->getLink(false);
                     if ($comment->comment) {
                         if ($comm = Comment::getVisibleById($comment->comment)) {
                             $str_addon .= " > " . $comm->name;
                         }
                     }
                 }
                 $str_addon .= ")";
             }
             break;
         case ITEM_COMPANY:
             if ($c = Company::getVisibleById($obj->id)) {
                 $str_name = asHtml($c->name);
                 $str_url = $PH->getUrl('companyView', array('company' => $c->id));
             }
             break;
         case ITEM_PERSON:
             if ($person = Person::getVisibleById($obj->id)) {
                 $str_name = asHtml($person->name);
                 $str_url = $PH->getUrl('personView', array('person' => $person->id));
             }
             break;
         case ITEM_PROJECTPERSON:
             if ($pp = ProjectPerson::getVisibleById($obj->id)) {
                 if (!($person = new Person($pp->person))) {
                     $PH->abortWarning("ProjectPerson has invalid person-pointer!", ERROR_BUG);
                 }
                 $str_name = asHtml($person->name);
                 $str_url = $PH->getUrl('personView', array('person' => $person->id));
                 if ($project = Project::getVisibleById($pp->project)) {
                     $str_addon = "(" . $project->getLink(false) . ")";
                 }
             }
             break;
         case ITEM_EMPLOYMENT:
             if ($emp = Employment::getById($obj->id)) {
                 if ($person = Person::getVisibleById($emp->person)) {
                     $str_name = asHtml($person->name);
                     $str_url = $PH->getUrl('personView', array('person' => $person->id));
                 }
                 if ($company = Company::getVisibleById($emp->company)) {
                     $str_addon = "(" . $company->getLink(false) . ")";
                 }
             }
             break;
         case ITEM_EFFORT:
             if ($e = Effort::getVisibleById($obj->id)) {
                 $str_name = asHtml($e->name);
                 $str_url = $PH->getUrl('effortEdit', array('effort' => $e->id));
                 if ($task = Task::getVisibleById($e->task)) {
                     if ($project = Project::getVisibleById($task->project)) {
                         $str_addon .= "(" . $project->getLink(false);
                         $str_addon .= " > " . $task->getLink(false) . ")";
                     }
                 }
             }
             break;
         case ITEM_FILE:
             if ($f = File::getVisibleById($obj->id)) {
                 $str_name = asHtml($f->org_filename);
                 $str_url = $PH->getUrl('fileView', array('file' => $f->id));
                 $str_addon .= "(";
                 if ($p = Project::getVisibleById($f->project)) {
                     $str_addon .= $p->getLink(false);
                 }
//.........这里部分代码省略.........
开发者ID:Bremaweb,项目名称:streber-1,代码行数:101,代码来源:list_changes.inc.php


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