Esempio n. 1
0
 /**
  * @return Reference
  */
 public function __construct(Tracker $tracker, $keyword)
 {
     $base_id = 0;
     $visibility = 'P';
     $is_used = 1;
     parent::__construct($base_id, $keyword, $GLOBALS['Language']->getText('project_reference', 'reference_art_desc_key') . ' - ' . $tracker->getName(), TRACKER_BASE_URL . '/?aid=$1&group_id=$group_id', $visibility, trackerPlugin::SERVICE_SHORTNAME, Tracker_Artifact::REFERENCE_NATURE, $is_used, $tracker->getGroupId());
 }
 public function __construct(Tracker $tracker)
 {
     $this->tracker = $tracker;
     foreach ($this->existing_colors as $color) {
         $this->colors[] = array('color' => $color, 'selected' => $color === $this->tracker->getColor());
     }
 }
 public function __construct(Tracker $tracker, array $stored_ugroups_permissions, PermissionsManager $permissions_manager)
 {
     $this->group_id = $tracker->getGroupId();
     $this->atid = $tracker->getId();
     $this->tracker = $tracker;
     $this->stored_ugroups_permissions = $stored_ugroups_permissions;
     $this->permissions_manager = $permissions_manager;
 }
 public function javascript_rules()
 {
     if ($this->render_with_javascript) {
         return $this->tracker->displayRulesAsJavascript();
     } else {
         return '';
     }
 }
 private function getFieldByName(Tracker $tracker, $field_name)
 {
     $field = $this->formelement_factory->getUsedFieldByName($tracker->getId(), $field_name);
     if (!$field) {
         throw new Tracker_FormElement_InvalidFieldException("Field {$field_name} does not exist in the tracker");
     }
     return $field;
 }
 public function getTitle()
 {
     $title = $GLOBALS['Language']->getText('plugin_agiledashboard', 'milestone_planning_pane_title', $this->submilestone_tracker->getName());
     if (ForgeConfig::get('sys_showdeprecatedplanningv1')) {
         $title .= ' V2';
     }
     return $title;
 }
Esempio n. 7
0
 /**
  * @return \Tracker 
  */
 public function build()
 {
     $tracker = new Tracker($this->id, $this->project_id, $this->name, null, $this->item_name, null, null, null, null, null, null, null);
     if ($this->project) {
         $tracker->setProject($this->project);
     }
     return $tracker;
 }
 /**
  * @return ProjectUGroup[]
  */
 public function getListOfInvolvedStaticUgroups(Tracker $template_tracker)
 {
     $project = $template_tracker->getProject();
     $ugroups = array();
     foreach ($this->permissions_dao->getAuthorizedStaticUgroupIds($template_tracker->getId()) as $id) {
         $ugroups[] = $this->ugroup_manager->getUGroup($project, $id);
     }
     return $ugroups;
 }
Esempio n. 9
0
 /**
  * @return Cardwall_OnTop_Config_ColumnCollection
  */
 private function getColumnsFromDao(Tracker $tracker)
 {
     $columns = new Cardwall_OnTop_Config_ColumnFreestyleCollection();
     foreach ($this->dao->searchColumnsByTrackerId($tracker->getId()) as $row) {
         list($bgcolor, $fgcolor) = $this->getColumnColorsFromRow($row);
         $columns[] = new Cardwall_Column($row['id'], $row['label'], $bgcolor, $fgcolor);
     }
     return $columns;
 }
 private function isArtifactInParentTracker(Tracker_Artifact $linked_artifact)
 {
     $linked_artifact_tracker_id = $linked_artifact->getTrackerId();
     $parent_tracker = $this->tracker->getParent();
     if ($parent_tracker) {
         return $parent_tracker->getId() == $linked_artifact_tracker_id;
     }
     return false;
 }
 public function itHasAllTriggeringFields()
 {
     $child_tracker = aTracker()->withId(200)->build();
     $this->target_tracker->setChildren(array($child_tracker));
     expect($this->formelement_factory)->getUsedStaticSbFields()->count(2);
     expect($this->formelement_factory)->getUsedStaticSbFields($child_tracker)->at(1);
     stub($this->formelement_factory)->getUsedStaticSbFields()->returnsEmptyDar();
     $this->factory->getForTracker($this->target_tracker);
 }
 public function getTrackerMapping(Tracker $tracker)
 {
     $tracker_id = $tracker->getId();
     $mapping_data = array($tracker_id => array('properties' => array('id' => array('type' => 'integer'), 'group_id' => array('type' => 'integer'), 'tracker_id' => array('type' => 'integer'), 'last_changeset_id' => array('type' => 'integer'), ElasticSearch_1_2_ArtifactPropertiesExtractor::LAST_UPDATE_PROPERTY => array('type' => 'date', 'format' => 'date_time_no_millis'), 'followup_comments' => array('properties' => array('user_id' => array('type' => 'integer'), 'date_added' => array('type' => 'date', 'format' => 'date_time_no_millis'), 'comment' => array('type' => 'string'))))));
     $this->addStandardTrackerPermissionsMetadata($mapping_data[$tracker_id]['properties']);
     $this->addStandardArtifactPermissionsMetadata($mapping_data[$tracker_id]['properties']);
     $this->artifact_properties_extractor->extractTrackerFields($tracker, $mapping_data);
     return $mapping_data;
 }
Esempio n. 13
0
 public function export(Tracker $tracker, SimpleXMLElement $xml_content, PFUser $user, ZipArchive $archive)
 {
     $artifacts_node = $xml_content->addChild('artifacts');
     $all_artifacts = $this->artifact_factory->getArtifactsByTrackerId($tracker->getId());
     $this->checkThreshold(count($all_artifacts));
     foreach ($all_artifacts as $artifact) {
         $artifact->exportToXML($artifacts_node, $user, $archive);
     }
     $this->rng_validator->validate($artifacts_node, realpath(dirname(TRACKER_BASE_DIR) . self::ARTIFACTS_RNG_PATH));
 }
 private function createArtifact(PFUser $current_user)
 {
     $email = null;
     if ($current_user->isAnonymous()) {
         $email = $this->request->get('email');
     }
     $fields_data = $this->request->get('artifact');
     $this->tracker->augmentDataFromRequest($fields_data);
     return $this->tracker_artifact_factory->createArtifact($this->tracker, $fields_data, $current_user, $email);
 }
 private function getMatchingIdsForTopBacklog(Planning_VirtualTopMilestone $milestone, Tracker $backlog_tracker, PFUser $user)
 {
     $strategy_unassigned = $this->strategy_factory->getSelfBacklogStrategy($milestone);
     $backlog_items = $this->backlog_item_collection_factory->getUnassignedOpenCollection($user, $milestone, $strategy_unassigned, false);
     foreach ($backlog_items as $backlog_item) {
         if ($backlog_item->getArtifact()->getTrackerId() == $backlog_tracker->getId()) {
             $this->backlog_ids[$backlog_item->getArtifact()->getId()] = true;
         }
     }
     return $this->backlog_ids;
 }
 private function getStatusValuesIndexedByLabel(Tracker $mapping_tracker)
 {
     $values = array();
     $field = $mapping_tracker->getStatusField();
     if ($field) {
         foreach ($field->getVisibleValuesPlusNoneIfAny() as $value) {
             $values[$value->getLabel()] = $value;
         }
     }
     return $values;
 }
 private function checkPermissionValidity(Tracker_Permission_PermissionRequest $request, Tracker $tracker)
 {
     if ($request->containsPermissionType(Tracker_Permission_Command::PERMISSION_ASSIGNEE) != null && $tracker->getContributorField() === null) {
         $GLOBALS['Response']->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('plugin_tracker_admin_permissions', 'no_assignee_semantic', array(TRACKER_BASE_URL . '/?' . http_build_query(array('func' => 'admin-semantic', 'tracker' => $tracker->getId())), $GLOBALS['Language']->getText('plugin_tracker_admin_semantic', 'contributor_label'))), CODENDI_PURIFIER_DISABLED);
         return false;
     }
     if ($request->getPermissionType(ProjectUGroup::PROJECT_ADMIN)) {
         return false;
     }
     return true;
 }
Esempio n. 18
0
 public function display()
 {
     $tracker = new Tracker();
     $history = $tracker->get_recently_viewed($GLOBALS['current_user']->id, array('Emails', 'EmailTemplates'));
     foreach ($history as $key => $row) {
         $history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
         $history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"');
     }
     $this->ss->assign('LAST_VIEWED', $history);
     $this->ss->display('include/MVC/View/tpls/modulelistmenu.tpl');
 }
Esempio n. 19
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $user_id = Request::get('user_id');
     $latitude = Request::get('latitude');
     $longitude = Request::get('longitude');
     $trackdata = new Tracker();
     $trackdata->user_id = $user_id;
     $trackdata->latitude = $latitude;
     $trackdata->longitude = $longitude;
     $trackdata->save();
     return Response::json(['success' => ['message' => 'Data added.', 'status_code' => 203]], 203);
 }
 private function getParentTrackersAndStopAtGivenTracker(Tracker $tracker, Tracker $stop)
 {
     $hierarchy = array();
     while (($parent = $this->hierarchy_factory->getParent($tracker)) && $parent != $stop) {
         $hierarchy[$parent->getId()] = $tracker;
         $tracker = $parent;
     }
     if ($parent == $stop) {
         $hierarchy[$stop->getId()] = $tracker;
         return $hierarchy;
     }
 }
 public function getPossibleArtifactParents(Tracker $parent_tracker, PFUser $user, $limit, $offset)
 {
     $label = '';
     $possible_parents = array();
     $display_selector = true;
     EventManager::instance()->processEvent(TRACKER_EVENT_ARTIFACT_PARENTS_SELECTOR, array('user' => $user, 'parent_tracker' => $parent_tracker, 'possible_parents' => &$possible_parents, 'label' => &$label, 'display_selector' => &$display_selector));
     if (!$possible_parents) {
         $label = $GLOBALS['Language']->getText('plugin_tracker_artifact', 'formelement_artifactlink_open_parent', array($parent_tracker->getName()));
         $possible_parents = $this->artifact_factory->getPaginatedPossibleParentArtifactsUserCanView($user, $parent_tracker->getId(), $limit, $offset);
     }
     return array($label, $possible_parents, $display_selector);
 }
Esempio n. 22
0
 /**
  * Function to get all the Tracker records
  * @param <Number> $limit - Limit on the number of records
  * @return <Array> - List of Vtiger_TrackRecord_Model instances
  */
 public static function getAll($limit = null)
 {
     require_once 'data/Tracker.php';
     $tracFocus = new Tracker();
     $userModel = Users_Record_Model::getCurrentUserModel();
     $list = $tracFocus->get_recently_viewed($userModel->getId());
     $trackRecords = array();
     foreach ($list as $record) {
         $trackRecords[] = self::getInstance($record);
     }
     return $trackRecords;
 }
 public function update(Tracker $tracker, SimpleXMLElement $artifact_xml, array $submitted_values, PFUser $user, $submitted_on)
 {
     $artifact_xml->changeset->submitted_on = date('c', $submitted_on);
     $artifact_xml->changeset->submitted_by = $user->getId();
     foreach ($artifact_xml->changeset->field_change as $field_change) {
         $field_name = (string) $field_change['field_name'];
         $field = $this->formelement_factory->getUsedFieldByNameForUser($tracker->getId(), $field_name, $user);
         if ($field && isset($submitted_values[$field->getId()])) {
             $submitted_value = $submitted_values[$field->getId()];
             $this->visitor->update($field_change, $field, $submitted_value);
         }
     }
 }
 public function send_email($dummy)
 {
     $rules = array('from_name' => 'required|max:128', 'from_email' => 'required|email|max:255', 'subject' => 'required|max:128', 'emailbody' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json(array('validation' => $validator->messages()->toArray()));
     } else {
         $from_name = Input::get('from_name');
         $from_email = Input::get('from_email');
         $selected = Input::get('to');
         $subject = Input::get('subject');
         $emailbody = Input::get('emailbody');
         $from = $from_name . ' (' . $from_email . ')';
         $recipients = Subscriber::whereIn('email', $selected)->where('active', '=', 1)->get();
         $email = new Email();
         $email->from = $from;
         $email->subject = $subject;
         $email->message = $emailbody;
         $email->save();
         $email_id = $email->id;
         $numrecipients = $recipients->count();
         $numsent = 0;
         foreach ($recipients as $key => $recipient) {
             $tracker = new Tracker();
             $tracker->subscriber_id = $recipient->id;
             $tracker->email_id = $email_id;
             $tracker->save();
             $tracker_id = $tracker->id;
             $tracker_url = URL::to('tracker/' . $tracker_id);
             $unsubscriber_url = URL::to('unsubscribe/' . $tracker_id);
             $subscriber = $recipient;
             $data = array('emailbody' => $emailbody, 'tracker' => $tracker_url, 'unsubscribe' => $unsubscriber_url, 'subscriber' => $subscriber);
             $to_email = $subscriber->email;
             $to_name = $subscriber->first_name . ' ' . $subscriber->last_name;
             $issent = Mail::send('emails.sub-emails', $data, function ($message) use($from_email, $from_name, $to_email, $to_name, $subject) {
                 $message->from($from_email, $from_name)->to($to_email, $to_name)->subject($subject);
             });
             if ($issent) {
                 $numsent += 1;
             } else {
                 $tracker->bounced = 1;
                 $tracker->save();
             }
         }
         if ($numsent == $numrecipients) {
             return Response::json(array('success' => 'Your email was successfully sent to <b>' . $numsent . '</b> subscribers out of the ' . $numrecipients . ' subscribers you selected. <b>Rejoice!</b>'));
         } else {
             return Response::json(array('success' => 'Your email was successfully sent to <b>' . $numsent . '</b> subscribers out of the ' . $numrecipients . 'All bounces have been logged.'));
         }
     }
 }
 private function getUGroupList(Tracker $tracker)
 {
     $ugroup_list = array();
     $ugroups_permissions = plugin_tracker_permission_get_tracker_ugroups_permissions($tracker->getGroupId(), $tracker->getId());
     ksort($ugroups_permissions);
     reset($ugroups_permissions);
     foreach ($ugroups_permissions as $ugroup_permissions) {
         $ugroup = $ugroup_permissions['ugroup'];
         $permissions = $ugroup_permissions['permissions'];
         if ($ugroup['id'] != ProjectUGroup::PROJECT_ADMIN) {
             $ugroup_list[] = new Tracker_Permission_PermissionUgroupPresenter($ugroup['id'], $ugroup['name'], isset($ugroup['link']) ? $ugroup['link'] : '', $this->getPermissionTypeList($ugroup['id'], $permissions));
         }
     }
     return $ugroup_list;
 }
Esempio n. 26
0
 /**
  * @param string $path
  */
 public function setPath($path)
 {
     if ($path && $path[0] != '/') {
         Tracker::_raiseError('The page path should always start with a slash ("/").', __METHOD__);
     }
     $this->path = $path;
 }
Esempio n. 27
0
 /**
  * @return Tracker_Artifact|null The created artifact
  */
 public function importOneArtifactFromXML(Tracker $tracker, SimpleXMLElement $xml_artifact, $extraction_path, TrackerXmlFieldsMapping $xml_fields_mapping)
 {
     try {
         $this->logger->info("Import {$xml_artifact['id']}");
         $files_importer = new Tracker_Artifact_XMLImport_CollectionOfFilesToImportInArtifact($xml_artifact);
         $fields_data_builder = new Tracker_Artifact_XMLImport_ArtifactFieldsDataBuilder($this->formelement_factory, $this->user_finder, $tracker, $files_importer, $extraction_path, $this->static_value_dao, $this->logger, $xml_fields_mapping);
         $tracker->getWorkflow()->disable();
         return $this->importOneArtifact($tracker, $xml_artifact, $fields_data_builder);
     } catch (Tracker_Artifact_Exception_CannotCreateInitialChangeset $exception) {
         $this->logger->error("Impossible to create artifact: " . $exception->getMessage());
     } catch (Tracker_Artifact_Exception_EmptyChangesetException $exception) {
         $this->logger->error("Impossible to create artifact, there is no valid data to import for initial changeset: " . $exception->getMessage());
     } catch (Exception $exception) {
         $this->logger->error("" . get_class($exception) . ': ' . $exception->getMessage() . ' in ' . $exception->getFile() . ' L' . $exception->getLine());
     }
 }
Esempio n. 28
0
 public function procede()
 {
     $aStats = Stats::getGlobalStats();
     $this->oView->addData('textItems', $aStats);
     $this->oView->addData('trackers', Tracker::getTrackersSelect());
     $this->oView->Create();
 }
 /**
  * @return array
  */
 public function getFieldsData(SimpleXMLElement $xml_field_change)
 {
     $data = array();
     if (!$xml_field_change->field_change) {
         return $data;
     }
     foreach ($xml_field_change->field_change as $field_change) {
         $field = $this->formelement_factory->getUsedFieldByName($this->tracker->getId(), (string) $field_change['field_name']);
         if ($field) {
             $this->appendValidValue($data, $field, $field_change);
         } else {
             $this->logger->debug("Skipped unknown/unused field " . (string) $field_change['field_name']);
         }
     }
     return $data;
 }
 /**
  * Synchronizes all issues from <b>$sourceIssues</b> into <b>$target</b> that
  * are not present in <b>$targetIssues</b>.
  *
  * @param \PivotalGitHubSync\Issue[] $sourceIssues
  * @param \PivotalGitHubSync\Issue[] $targetIssues
  * @param \PivotalGitHubSync\Tracker $target
  * @return integer
  */
 protected function doSynchronize(array $sourceIssues, array $targetIssues, Tracker $target)
 {
     $synced = 0;
     foreach ($sourceIssues as $sourceIssue) {
         foreach ($targetIssues as $targetIssue) {
             if ($targetIssue->equals($sourceIssue)) {
                 continue 2;
             }
         }
         if (false === $sourceIssue->closed) {
             $target->addIssue($sourceIssue);
         }
         ++$synced;
     }
     return $synced;
 }