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


PHP ReferenceManager类代码示例

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


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

示例1: removePreviousCrossReferences

 private function removePreviousCrossReferences(Project $project, $revision, $old_commit_message)
 {
     $GLOBALS['group_id'] = $project->getID();
     $references = $this->reference_manager->extractReferences($old_commit_message, $project->getID());
     foreach ($references as $reference_instance) {
         /* @var $reference Reference */
         $reference = $reference_instance->getReference();
         if ($reference) {
             $cross_reference = new CrossReference($revision, $project->getID(), ReferenceManager::REFERENCE_NATURE_SVNREVISION, '', $reference_instance->getValue(), $reference->getGroupId(), $reference->getNature(), '', '');
             $this->reference_manager->removeCrossReference($cross_reference);
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:13,代码来源:PostRevPropset.class.php

示例2: service_create_service

/**
* Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
* 
* 
* 
*/
function service_create_service($arr, $group_id, $template, $force_enable = false)
{
    // Convert link to real values
    // NOTE: if you change link variables here, change them also in src/www/project/admin/servicebar.php and src/www/include/Layout.class.php
    $link = $arr['link'];
    $pm = ProjectManager::instance();
    if ($template['system']) {
        $link = str_replace('$projectname', $pm->getProject($group_id)->getUnixName(), $link);
        $link = str_replace('$sys_default_domain', $GLOBALS['sys_default_domain'], $link);
        $link = str_replace('$group_id', $group_id, $link);
        if ($GLOBALS['sys_force_ssl']) {
            $sys_default_protocol = 'https';
        } else {
            $sys_default_protocol = 'http';
        }
        $link = str_replace('$sys_default_protocol', $sys_default_protocol, $link);
    } else {
        //for non-system templates
        $link = service_replace_template_name_in_link($link, $template, $pm->getProject($group_id));
    }
    $is_used = isset($template['is_used']) ? $template['is_used'] : $arr['is_used'];
    $server_id = isset($template['server_id']) ? $template['server_id'] : $arr['server_id'];
    $sql = "INSERT INTO service (group_id, label, description, short_name, link, is_active, is_used, scope, rank, location, server_id, is_in_iframe) VALUES (" . db_ei($group_id) . ", '" . db_es($arr['label']) . "', '" . db_es($arr['description']) . "', '" . db_es($arr['short_name']) . "', '" . db_es($link) . "', " . db_ei($arr['is_active']) . ", " . ($force_enable ? 1 : db_ei($is_used)) . ", '" . db_es($arr['scope']) . "', " . db_ei($arr['rank']) . ",  '" . db_es($arr['location']) . "', " . db_ei($server_id) . ", " . db_ei($arr['is_in_iframe']) . ")";
    $result = db_query($sql);
    if ($result) {
        // activate corresponding references
        $reference_manager =& ReferenceManager::instance();
        if ($arr['short_name'] != "") {
            $reference_manager->addSystemReferencesForService($template['id'], $group_id, $arr['short_name']);
        }
        return true;
    } else {
        return false;
    }
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:41,代码来源:service.php

示例3: doCreate

 private function doCreate()
 {
     $projectCreator = new ProjectCreator($this->project_manager, ReferenceManager::instance());
     $data = $this->creation_request->getProjectValues();
     $creationData = ProjectCreationData::buildFromFormArray($data);
     return $projectCreator->build($creationData);
 }
开发者ID:lincoln56,项目名称:tuleap,代码行数:7,代码来源:OneStepCreationController.class.php

示例4: initTrackerV3ModuleFromTemplate

 private function initTrackerV3ModuleFromTemplate(Group $group, Group $template_group, $ugroup_mapping)
 {
     $group_id = $group->getID();
     $tracker_mapping = array();
     $report_mapping = array();
     if (TrackerV3::instance()->available()) {
         $atf = new ArtifactTypeFactory($template_group);
         //$tracker_error = "";
         // Add all trackers from template project (tracker templates) that need to be instanciated for new trackers.
         $res = $atf->getTrackerTemplatesForNewProjects();
         while ($arr_template = db_fetch_array($res)) {
             $ath_temp = new ArtifactType($template_group, $arr_template['group_artifact_id']);
             $report_mapping_for_this_tracker = array();
             $new_at_id = $atf->create($group_id, $template_group->getID(), $ath_temp->getID(), db_escape_string($ath_temp->getName()), db_escape_string($ath_temp->getDescription()), $ath_temp->getItemName(), $ugroup_mapping, $report_mapping_for_this_tracker);
             if (!$new_at_id) {
                 $GLOBALS['Response']->addFeedback('error', $atf->getErrorMessage());
             } else {
                 $report_mapping = $report_mapping + $report_mapping_for_this_tracker;
                 $tracker_mapping[$ath_temp->getID()] = $new_at_id;
                 // Copy all the artifacts from the template tracker to the new tracker
                 $ath_new = new ArtifactType($group, $new_at_id);
                 // not now. perhaps one day
                 //if (!$ath_new->copyArtifacts($ath_temp->getID()) ) {
                 //$GLOBALS['Response']->addFeedback('info', $ath_new->getErrorMessage());
                 //}
                 // Create corresponding reference
                 $ref = new Reference(0, strtolower($ath_temp->getItemName()), $GLOBALS['Language']->getText('project_reference', 'reference_art_desc_key'), '/tracker/?func=detail&aid=$1&group_id=$group_id', 'P', 'tracker', ReferenceManager::REFERENCE_NATURE_ARTIFACT, '1', $group_id);
                 $result = $this->reference_manager->createReference($ref, true);
                 // Force reference creation because default trackers use reserved keywords
             }
         }
     }
     return array($tracker_mapping, $report_mapping);
 }
开发者ID:superlinger,项目名称:tuleap,代码行数:34,代码来源:ProjectCreator.class.php

示例5: GivenAProjectCreator

 /**
  * @return ProjectCreator
  */
 private function GivenAProjectCreator()
 {
     $projectManager = new MockProjectManager();
     $creator = TestHelper::getPartialMock('ProjectCreator', array('createProject'));
     $creator->__construct($projectManager, ReferenceManager::instance());
     return $creator;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:ProjectCreatorTest.php

示例6: generate

 function generate()
 {
     global $Language;
     $request =& HTTPRequest::instance();
     if ($data = $request->get('data')) {
         if (isset($data['users']['generate']) && $data['users']['generate']) {
             $um = UserManager::instance();
             $nb_wanted = isset($data['users']['nb']) ? (int) $data['users']['nb'] : 1;
             $users = $this->_getUsersData();
             reset($users);
             $nb_done = 0;
             while ((list(, $user) = each($users)) && $nb_wanted > $nb_done) {
                 if (!$um->getUserByUserName($user['name'])) {
                     require_once 'account.php';
                     account_create($user['name'], 'codendi', '', $user['realname'], '', '379fbec92fb84a72d6026a422@mailinator.com', 'A', '', 0, 0, 'Europe/Paris', 'en_US', 'A');
                     $nb_done++;
                 }
             }
         }
         if (isset($data['projects']['generate']) && $data['projects']['generate']) {
             $nb_wanted = isset($data['projects']['nb']) ? (int) $data['projects']['nb'] : 1;
             $projects = $this->_getProjectsData();
             reset($projects);
             $nb_done = 0;
             while ((list(, $project) = each($projects)) && $nb_wanted > $nb_done) {
                 if (!group_get_object_by_name($project['name'])) {
                     $projectCreator = new ProjectCreator(ProjectManager::instance(), ReferenceManager::instance());
                     $projectCreator->create(array('project' => array('form_unix_name' => $project['name'], 'form_full_name' => $project['name'], 'form_short_description' => $project['description'], 'form_purpose' => $project['description'], 'form_required_sw' => '', 'form_patents' => '', 'form_comments' => '', 'built_from_template' => 100, 'is_test' => false, 'is_public' => true, 'trove' => array())));
                     $nb_done++;
                 }
             }
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:34,代码来源:DataGeneratorActions.class.php

示例7: onOutputPageBeforeHTML

 public static function onOutputPageBeforeHTML(OutputPage &$out, &$text)
 {
     global $wgTuleapArtLinksGroupId;
     $reference_manager = ReferenceManager::instance();
     $reference_manager->insertReferences($text, $wgTuleapArtLinksGroupId);
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:TuleapArtLinks.hooks.php

示例8: itCreatesAProject

 public function itCreatesAProject()
 {
     $projectCreator = new ProjectCreator(ProjectManager::instance(), ReferenceManager::instance());
     $projectCreator->create('short-name', 'Long name', array('project' => array('form_short_description' => '', 'is_test' => false, 'is_public' => false, 'services' => array(), 'built_from_template' => 100)));
     ProjectManager::clearInstance();
     $project = ProjectManager::instance()->getProjectByUnixName('short-name');
     $this->assertEqual($project->getPublicName(), 'Long name');
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:ProjectCreationTest.php

示例9: __construct

 public function __construct(EventManager $event_manager, ProjectManager $project_manager, XML_RNGValidator $xml_validator, UGroupManager $ugroup_manager, User\XML\Import\IFindUserFromXMLReference $user_finder, Logger $logger)
 {
     $this->event_manager = $event_manager;
     $this->project_manager = $project_manager;
     $this->xml_validator = $xml_validator;
     $this->ugroup_manager = $ugroup_manager;
     $this->user_finder = $user_finder;
     $this->logger = $logger;
     $this->project_creator = new ProjectCreator($this->project_manager, ReferenceManager::instance(), true);
 }
开发者ID:blestab,项目名称:tuleap,代码行数:10,代码来源:ProjectXMLImporter.class.php

示例10: getListPage

 /**
  * Récupérer une liste d'articles en fonction de critères
  * @param   array   $params         tableau associatif contenant les critères de sélection. clé : nom du paramètre, valeur : valeur du paramètre
  * @param   array   $infosPages     tableau associatif contenant des indications sur le nombre de pages, la liste des numéros de pages disponibles, etc.
  * @return  array   liste des articles
  * @see Manager::getIndexPages
  * @see Manager::_getListPage
  * @see Manager::_getCount
  */
 function getListPage($params, &$infosPages)
 {
     // Construction de la requête en fonction des paramètres
     $sql = 'SELECT a.doc_id as id, doc_auteurs,
           doc_titre as titre, doc_etat as etat, doc_date_publication,
           doc_date_enregistrement, doc_date_modification,
           u.uti_nom as nom, u.uti_prenom as prenom ';
     $from = ' FROM uti_utilisateur u, doc_document a';
     $where = ' WHERE u.uti_id = a.uti_id_soumis ';
     if (isset($params['uti']) && intval($params['uti']) > 0) {
         $where .= ' AND uti_id_soumis = ' . intval($params['uti']);
     }
     if (isset($params['status']) && is_numeric($params['status'])) {
         $where .= ' AND doc_etat = ' . trim($params['status']);
     }
     if (isset($params['type']) && strlen($params['type']) == 1) {
         $where .= ' AND typ_id = \'' . trim($params['type']) . '\'';
     }
     $ref = new ReferenceManager($this->db);
     $i = 0;
     foreach ($params as $clef => $val) {
         if (strpos($clef, 'cri_') === 0 && $val != 'none') {
             $crit = $ref->getCriterionInfos(substr($clef, 4));
             $crit = $crit['id'];
             $tmpsql = 'SELECT doc_id FROM doc_document WHERE doc_repertoire = ' . $this->db->quote($val);
             $res = $this->_getRow($tmpsql);
             $intro = $res['doc_id'];
             $from .= ", document_criteres c{$i}";
             $where .= " AND a.doc_id = c{$i}.doc_id AND c{$i}.cri_id = " . intval($crit) . " AND c{$i}.intro_id = " . intval($intro);
             $i++;
         }
     }
     if (isset($params['pg'])) {
         $page = intval($params['pg']);
     } else {
         $page = 0;
     }
     $nombreLigneTotal = $this->_getCount($from . $where);
     $infosPages = $this->getIndexPages($page, $this->nbParPage, $nombreLigneTotal, $this->nbLiensMax);
     $sql = $sql . $from . $where . " ORDER BY doc_date_enregistrement DESC";
     return $this->_getListPage($sql, $page, $this->nbParPage);
 }
开发者ID:BackupTheBerlios,项目名称:openweb-cms-svn,代码行数:51,代码来源:DocumentManager.class.php

示例11: build

 /**
  * @return Tracker_Artifact_XMLImport
  */
 public function build(User\XML\Import\IFindUserFromXMLReference $user_finder)
 {
     $artifact_factory = Tracker_ArtifactFactory::instance();
     $formelement_factory = Tracker_FormElementFactory::instance();
     $fields_validator = new Tracker_Artifact_Changeset_AtGivenDateFieldsValidator($formelement_factory);
     $changeset_dao = new Tracker_Artifact_ChangesetDao();
     $changeset_comment_dao = new Tracker_Artifact_Changeset_CommentDao();
     $logger = new Log_ConsoleLogger();
     $send_notifications = false;
     $artifact_creator = new Tracker_ArtifactCreator($artifact_factory, $fields_validator, new Tracker_Artifact_Changeset_InitialChangesetAtGivenDateCreator($fields_validator, $formelement_factory, $changeset_dao, $artifact_factory, EventManager::instance()));
     $new_changeset_creator = new Tracker_Artifact_Changeset_NewChangesetAtGivenDateCreator($fields_validator, $formelement_factory, $changeset_dao, $changeset_comment_dao, $artifact_factory, EventManager::instance(), ReferenceManager::instance());
     return new Tracker_Artifact_XMLImport(new XML_RNGValidator(), $artifact_creator, $new_changeset_creator, Tracker_FormElementFactory::instance(), $user_finder, new Tracker_FormElement_Field_List_Bind_Static_ValueDao(), $logger, $send_notifications);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:16,代码来源:XMLImportBuilder.class.php

示例12: getReferencesTable

function getReferencesTable($groupId)
{
    $html = '';
    $html .= '<h3>' . $GLOBALS['Language']->getText('project_showdetails', 'references') . '</h3>';
    $title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_keyword');
    $title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_desc');
    $title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_link');
    $html .= html_build_list_table_top($title_arr, false, false, true);
    $referenceManager =& ReferenceManager::instance();
    $references =& $referenceManager->getReferencesByGroupId($groupId);
    // References are sorted by scope first
    $row_num = 0;
    foreach ($references as $ref) {
        $html .= getReferenceRow($ref, $row_num);
        $row_num++;
    }
    $html .= '</table>';
    return $html;
}
开发者ID:nterray,项目名称:tuleap,代码行数:19,代码来源:showdetails.php

示例13: createMailForUsers


//.........这里部分代码省略.........
     if ($changes) {
         $body = $GLOBALS['sys_lf'] . "=============   " . strtoupper(SimpleSanitizer::unsanitize($this->ArtifactType->getName())) . " #" . $this->getID() . ": " . $Language->getText('tracker_include_artifact', 'latest_modif') . "   =============" . $GLOBALS['sys_lf'] . $artifact_href . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $this->formatChanges($changes, $field_perm, $visible_change) . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "";
         if (!$visible_change) {
             return;
         }
     }
     $ok = true;
     $visible_snapshot = false;
     $full_snapshot = "";
     // We write the name of the project
     $pm = ProjectManager::instance();
     $full_snapshot .= sprintf($fmt_left . $GLOBALS['sys_lf'] . "", $Language->getText('tracker_include_artifact', 'project') . ' ' . util_unconvert_htmlspecialchars($pm->getProject($group_id)->getPublicName()));
     // Write all the fields, grouped by fieldsetset and ordered by rank.
     $left = 1;
     $visible_fieldset = false;
     // fetch list of used fieldsets for this artifact
     foreach ($used_fieldsets as $fieldset_id => $fieldset) {
         $fieldset_snapshot = '';
         $used_fields = $fieldset->getAllUsedFields();
         // fetch list of used fields and the current field values
         // for this artifact
         while (list($key, $field) = each($used_fields)) {
             $field_name = $field->getName();
             if ($field_perm === false || isset($field_perm[$field_name]) && $field_perm[$field_name] && permission_can_read_field($field_perm[$field_name])) {
                 $field_html = new ArtifactFieldHtml($field);
                 $visible_fieldset = true;
                 $visible_snapshot = true;
                 // For multi select box, we need to retrieve all the values
                 if ($field->isMultiSelectBox()) {
                     $field_value = $field->getValues($this->getID());
                 } else {
                     $field_value = $this->getValue($field->getName());
                 }
                 $display = $field_html->display($group_artifact_id, $field_value, false, true, true, true);
                 $item = sprintf($left ? $fmt_left : $fmt_right, $display);
                 if (strlen($item) > $fmt_len) {
                     if (!$left) {
                         $fieldset_snapshot .= "" . $GLOBALS['sys_lf'] . "";
                     }
                     $fieldset_snapshot .= sprintf($fmt_right, $display);
                     $fieldset_snapshot .= "" . $GLOBALS['sys_lf'] . "";
                     $left = 1;
                 } else {
                     $fieldset_snapshot .= $item;
                     $left = !$left;
                     if ($left) {
                         $fieldset_snapshot .= "" . $GLOBALS['sys_lf'] . "";
                     }
                 }
             }
         }
         // while
         if ($visible_fieldset) {
             $full_snapshot .= "" . $GLOBALS['sys_lf'] . "";
             $full_snapshot .= $left ? "" : "" . $GLOBALS['sys_lf'] . "";
             $full_snapshot .= '--- ' . SimpleSanitizer::unsanitize($fieldset->getLabel()) . ' ---';
             $full_snapshot .= "" . $GLOBALS['sys_lf'] . "";
             $full_snapshot .= $fieldset_snapshot;
         }
     }
     if ($visible_snapshot) {
         $full_snapshot .= "" . $GLOBALS['sys_lf'] . "";
     }
     $body .= "=============   " . strtoupper(SimpleSanitizer::unsanitize($this->ArtifactType->getName())) . " #" . $this->getID() . ": " . $Language->getText('tracker_include_artifact', 'full_snapshot') . "   =============" . $GLOBALS['sys_lf'] . ($changes ? '' : $artifact_href) . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $full_snapshot;
     if (!$left) {
         $body .= "" . $GLOBALS['sys_lf'] . "";
     }
     // Now display other special fields
     // Then output the history of bug comments from newest to oldest
     $body .= $this->showFollowUpComments($group_id, 0, self::OUTPUT_MAIL_TEXT);
     // Then output the CC list
     $body .= "" . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $this->showCCList($group_id, $group_artifact_id, true);
     // Then output the dependencies
     $body .= "" . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $this->showDependencies($group_id, $group_artifact_id, true);
     // Then output the history of attached files from newest to oldest
     $body .= "" . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $this->showAttachedFiles($group_id, $group_artifact_id, true);
     // Extract references from the message
     $referenceManager =& ReferenceManager::instance();
     $ref_array = $referenceManager->extractReferencesGrouped($body, $group_id);
     if (count($ref_array) > 0) {
         $body .= $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $Language->getText('tracker_include_artifact', 'references') . $GLOBALS['sys_lf'];
     }
     foreach ($ref_array as $description => $match_array) {
         $body .= $GLOBALS['sys_lf'] . $description . ":" . $GLOBALS['sys_lf'];
         foreach ($match_array as $match => $ref_instance) {
             $reference =& $ref_instance->getReference();
             $body .= ' ' . $ref_instance->getMatch() . ': ' . $ref_instance->getFullGotoLink() . $GLOBALS['sys_lf'];
         }
     }
     // Finally output the message trailer
     $body .= "" . $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . $Language->getText('tracker_include_artifact', 'follow_link');
     $body .= "" . $GLOBALS['sys_lf'] . $artifact_href;
     if ($ok) {
         $mail = new Mail();
         $mail->setBody($body);
         return $mail;
     } else {
         return null;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:101,代码来源:Artifact.class.php

示例14: strtoupper

 $oRef->ref_emb_vlm_ctn = $_REQUEST['refEmbVlmCtn'];
 $oRef->ref_emb_dim_lng = $_REQUEST['refEmbDimLng'];
 $oRef->ref_emb_dim_lrg = $_REQUEST['refEmbDimLrg'];
 $oRef->ref_emb_dim_ht = $_REQUEST['refEmbDimHt'];
 $oRef->ref_emb_dim_diam = $_REQUEST['refEmbDimDiam'];
 $oRef->ref_com = $_REQUEST['refCom'];
 $oRef->ref_code = strtoupper($_REQUEST['refCode']);
 $oRef->ref_mrq = $_REQUEST['refMrq'];
 $oRef->ref_code_douane = $_REQUEST['refCodeDouane'];
 $resPhoto = Tool::uplImg($imgPath, $imgMiniPath, $imgExtension, $imgMaxSize);
 if (count($resPhoto) > 0 && $resPhoto[0] != '') {
     $oRef->ref_photos = implode(',', $resPhoto);
     $oRef->ref_photos_pref = $resPhoto[0];
 }
 //Tool::printAnyCase($oRef);
 $resAddRef = ReferenceManager::addReference($oRef);
 $idRef = Connection::dernierId();
 if (isset($_REQUEST['pvePer']) && !empty($_REQUEST['pvePer']) || isset($_REQUEST['pveEnt']) && !empty($_REQUEST['pveEnt'])) {
     require $path . '/model/PrixVente.php';
     require $path . '/model/PrixVenteManager.php';
     $oPve = new PrixVente();
     $oPve->ref_id = $idRef;
     $oPve->pve_ent = $_REQUEST['pveEnt'];
     $oPve->pve_per = $_REQUEST['pvePer'];
     $resPv = PrixVenteManager::addPrixVente($oPve);
 }
 $cnx->commit();
 $msg = "<p class='info'>" . date('H:i:s') . " La référence " . $oRef->ref_lbl . " a été enregistré" . " avec succès</p>";
 $_SESSION['token'] = $_REQUEST['token'];
 $sAction = 'ref_list';
 require $path . '/controler/control_ref_list.php';
开发者ID:Arcken,项目名称:SOLYA,代码行数:31,代码来源:control_ref_add.php

示例15: getHTMLDisplayCrossRefs

 function getHTMLDisplayCrossRefs($with_links = true, $condensed = false, $isBrowser = true)
 {
     global $Language;
     /**
      * Array of cross references grouped by nature (to easy cross reference display)
      * Array has the form:
      * ['nature1'] => array (
      *                  ['both'] => array (
      *                                  CrossReference1,
      *                                  CrossReference2,
      *                                  ...)
      *                  ['source'] => array (
      *                                  CrossReference3,
      *                                  CrossReference4,
      *                                  ...)
      *                  ['target'] => array (
      *                                  CrossReference3,
      *                                  CrossReference4,
      *                                  ...)
      *  ['nature2'] => array (
      *                  ['both'] => array (
      *                                  CrossReference5,
      *                                  CrossReference6,
      *                                  ...)
      *                  ['source'] => array (
      *                                  CrossReference7,
      *                                  CrossReference8,
      *                                  ...)
      *                  ['target'] => array (
      *                                  CrossReference9,
      *                                  CrossReference10,
      *                                  ...)
      *  ...
      */
     $crossRefArray = $this->getCrossReferences();
     $reference_manager = ReferenceManager::instance();
     $available_natures = $reference_manager->getAvailableNatures();
     $user = UserManager::instance()->getCurrentUser();
     $itemIsReferenced = false;
     if ($isBrowser && ($user->isSuperUser() || $user->isMember($this->entity_gid, 'A'))) {
         $can_delete = true;
     } else {
         $can_delete = false;
     }
     $classes = array('both' => 'cross_reference', 'source' => 'referenced_by', 'target' => 'reference_to');
     $img = array('both' => array('both_arrows', 'cross_referenced'), 'source' => array('left_arrow', 'referenced_in'), 'target' => array('right_arrow', 'reference_to'));
     $message = addslashes($GLOBALS['Language']->getText('cross_ref_fact_include', 'confirm_delete'));
     // HTML part (stored in $display)
     $display = '';
     if (!$condensed) {
         $display .= '<p id="cross_references_legend">' . $Language->getText('cross_ref_fact_include', 'legend') . '</p>';
     }
     // loop through natures
     foreach ($crossRefArray as $nature => $refArraySourceTarget) {
         $display .= '<div class="nature">';
         if (!$condensed) {
             $display .= "<p><b>" . $available_natures[$nature]['label'] . "</b>";
         }
         // loop through each type of target
         $display .= '<ul class="cross_reference_list">';
         foreach (array('both', 'target', 'source') as $key) {
             if (array_key_exists($key, $refArraySourceTarget)) {
                 // one li for one type of ref (both, target, source)
                 $display .= '<li class="' . $classes[$key] . '">';
                 $display .= $GLOBALS['HTML']->getImage('ic/' . $img[$key][0] . '.png', array('alt' => $Language->getText('cross_ref_fact_include', $img[$key][1]), 'align' => 'top-left', 'hspace' => '5', 'title' => $Language->getText('cross_ref_fact_include', $img[$key][1])));
                 // the refs
                 $spans = array();
                 foreach ($refArraySourceTarget[$key] as $currRef) {
                     $span = '';
                     if ($key === 'source') {
                         $id = $currRef->getRefSourceKey() . "_" . $currRef->getRefSourceId();
                         $ref = $currRef->getRefSourceKey() . " #" . $currRef->getRefSourceId();
                         $url = $currRef->getRefSourceUrl();
                     } else {
                         $id = $currRef->getRefTargetKey() . "_" . $currRef->getRefTargetId();
                         $ref = $currRef->getRefTargetKey() . " #" . $currRef->getRefTargetId();
                         $url = $currRef->getRefTargetUrl();
                     }
                     $span .= '<span id="' . $id . '" class="link_to_ref">';
                     if ($with_links) {
                         $span .= '<a class="cross-reference" 
                                         title="' . $available_natures[$nature]['label'] . '" 
                                         href="' . $url . '">';
                         $span .= $ref . '</a>';
                     } else {
                         $span .= $ref;
                     }
                     if ($with_links && $can_delete && !$condensed) {
                         $params = $this->getParams($currRef);
                         $span .= '<a class="delete_ref" 
                                        href="/reference/rmreference.php' . $params . '"
                                        onClick="return delete_ref(\'' . $id . '\', \'' . $message . '\');">';
                         $span .= $GLOBALS['HTML']->getImage('ic/cross.png', array('alt' => $Language->getText('cross_ref_fact_include', 'delete'), 'title' => $Language->getText('cross_ref_fact_include', 'delete')));
                         $span .= '</a>';
                     }
                     $spans[] = $span;
                 }
                 $display .= implode(', </span>', $spans) . '</span>';
                 $display .= '</li>';
             }
//.........这里部分代码省略.........
开发者ID:nterray,项目名称:tuleap,代码行数:101,代码来源:CrossReferenceFactory.class.php


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