Esempio n. 1
0
function &getUsers($session_ser, $user_ids)
{
    continue_session($session_ser);
    $usrs =& user_get_objects($user_ids);
    if (!$usrs) {
        return new soap_fault('3001', 'user', 'Could Not Get Users By Id', 'Could Not Get Users By Id');
    }
    return users_to_soap($usrs);
}
Esempio n. 2
0
function &user_get_objects_by_name($username_arr)
{
    $res = db_query("SELECT user_id FROM users WHERE user_name IN ('" . implode($username_arr, '\',\'') . "')");
    $arr =& util_result_column_to_array($res, 0);
    return user_get_objects($arr);
}
Esempio n. 3
0
 $task = $tasks[$tc];
 $return .= '<task id ="' . $task->getID() . '">';
 $return .= '<projectid>' . $task->getExternalID() . '</projectid>';
 $return .= '<name>' . $task->getSummary() . '</name>';
 $return .= '<start_date>' . date('Y-m-d H:i:s', $task->getStartDate()) . '</start_date>';
 $return .= '<end_date>' . date('Y-m-d H:i:s', $task->getEndDate()) . '</end_date>';
 $return .= '<work>' . $task->getHours() . '</work>';
 $return .= '<duration>' . $task->getDuration() . '</duration>';
 $return .= '<percent_complete>' . $task->getPercentComplete() . '</percent_complete>';
 $return .= '<priority>' . $task->getPriority() . '</priority>';
 $return .= '<lastmodified>';
 if ($task->getLastModifiedDate() != "") {
     $return .= date('Y-m-d H:i:s', $task->getLastModifiedDate());
 }
 $return .= '</lastmodified>';
 $users =& user_get_objects($task->getAssignedTo());
 if (count($users) == 1 && $users[0]->getID() == 100) {
     //skip if only one user - the 100 user
 } else {
     $return .= '<resources>';
     for ($i = 0; $i < count($users); $i++) {
         $return .= '<resourcename>' . $users[$i]->getUnixName() . '</resourcename>';
     }
     $return .= '</resources>';
 }
 $dependenton =& $task->getDependentOn();
 if (count($dependenton) == 1 && $dependenton[100]) {
     //skip if only one user - the 100 user
 } else {
     $return .= '<dependenton>';
     reset($dependenton);
Esempio n. 4
0
 /**
  *	mailFollowup - send out an email update for this artifact.
  *
  *	@param	int		(1) initial/creation (2) update.
  *	@param	array	Array of additional addresses to mail to.
  *	@param	array	Array of fields changed in this update .
  *	@access private.
  *	@return	boolean	success.
  */
 function mailFollowup($type, $more_addresses = false, $changes = '')
 {
     if (!$changes) {
         $changes = array();
     }
     $sess = session_get_user();
     if ($type == 1) {
         // Initial opening
         if ($sess) {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was opened at " . date(_('Y-m-d H:i'), $this->getOpenDate()) . " by " . $sess->getRealName();
         } else {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was opened at " . date(_('Y-m-d H:i'), $this->getOpenDate());
         }
     } else {
         if ($sess) {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was changed at " . date(_('Y-m-d H:i'), $this->getOpenDate()) . " by " . $sess->getRealName();
         } else {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was changed at " . date(_('Y-m-d H:i'), $this->getOpenDate());
         }
     }
     $body .= "\nYou can respond by visiting: " . "\n" . util_make_url('/tracker/?func=detail&atid=' . $this->ArtifactType->getID() . "&aid=" . $this->getID() . "&group_id=" . $this->ArtifactType->Group->getID()) . "\nOr by replying to this e-mail entering your response between the following markers: " . "\n" . ARTIFACT_MAIL_MARKER . "\n(enter your response here)" . "\n" . ARTIFACT_MAIL_MARKER . "\n\n" . $this->marker('status', $changes) . "Status: " . $this->getStatusName() . "\n" . $this->marker('priority', $changes) . "Priority: " . $this->getPriority() . "\n" . "Submitted By: " . $this->getSubmittedRealName() . " (" . $this->getSubmittedUnixName() . ")" . "\n" . $this->marker('assigned_to', $changes) . "Assigned to: " . $this->getAssignedRealName() . " (" . $this->getAssignedUnixName() . ")" . "\n" . $this->marker('summary', $changes) . "Summary: " . util_unconvert_htmlspecialchars($this->getSummary()) . " \n";
     // Now display the extra fields
     $efd = $this->getExtraFieldDataText();
     foreach ($efd as $efid => $ef) {
         $body .= $this->marker('extra_fields', $changes, $efid);
         $body .= $ef["name"] . ": " . $ef["value"] . "\n";
     }
     $subject = '[' . $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() . '][' . $this->getID() . '] ' . util_unconvert_htmlspecialchars($this->getSummary());
     if ($type > 1) {
         // get all the email addresses that are monitoring this request or the ArtifactType
         $monitor_ids =& $this->getMonitorIds();
     } else {
         // initial creation, we just get the users monitoring the ArtifactType
         $monitor_ids =& $this->ArtifactType->getMonitorIds();
     }
     $emails = array();
     if ($more_addresses) {
         $emails[] = $more_addresses;
     }
     //we don't email the current user
     if ($this->getAssignedTo() != user_getid()) {
         $monitor_ids[] = $this->getAssignedTo();
     }
     if ($this->getSubmittedBy() != user_getid()) {
         $monitor_ids[] = $this->getSubmittedBy();
     }
     //initial submission
     if ($type == 1) {
         //if an email is set for this ArtifactType
         //add that address to the BCC: list
         if ($this->ArtifactType->getEmailAddress()) {
             $emails[] = $this->ArtifactType->getEmailAddress();
         }
     } else {
         //update
         if ($this->ArtifactType->emailAll()) {
             $emails[] = $this->ArtifactType->getEmailAddress();
         }
     }
     $body .= "\n\nInitial Comment:" . "\n" . util_unconvert_htmlspecialchars($this->getDetails()) . "\n\n----------------------------------------------------------------------";
     if ($type > 1) {
         /*
         	Now include the followups
         */
         $result2 = $this->getMessages();
         $rows = db_numrows($result2);
         if ($result2 && $rows > 0) {
             for ($i = 0; $i < $rows; $i++) {
                 //
                 //	for messages posted by non-logged-in users,
                 //	we grab the email they gave us
                 //
                 //	otherwise we use the confirmed one from the users table
                 //
                 if (db_result($result2, $i, 'user_id') == 100) {
                     $emails[] = db_result($result2, $i, 'from_email');
                 } else {
                     $monitor_ids[] = db_result($result2, $i, 'user_id');
                 }
                 $body .= "\n\n";
                 if ($i == 0) {
                     $body .= $this->marker('details', $changes);
                 }
                 $body .= "Comment By: " . db_result($result2, $i, 'realname') . " (" . db_result($result2, $i, 'user_name') . ")" . "\nDate: " . date(_('Y-m-d H:i'), db_result($result2, $i, 'adddate')) . "\n\nMessage:" . "\n" . util_unconvert_htmlspecialchars(db_result($result2, $i, 'body')) . "\n\n----------------------------------------------------------------------";
             }
         }
     }
     $body .= "\n\nYou can respond by visiting: " . "\n" . util_make_url('/tracker/?func=detail&atid=' . $this->ArtifactType->getID() . "&aid=" . $this->getID() . "&group_id=" . $this->ArtifactType->Group->getID());
     //only send if some recipients were found
     if (count($emails) < 1 && count($monitor_ids) < 1) {
         return true;
     }
     if (count($monitor_ids) < 1) {
         $monitor_ids = array();
     } else {
         $monitor_ids = array_unique($monitor_ids);
     }
     $from = $this->ArtifactType->getReturnEmailAddress();
     $extra_headers = 'Reply-to: ' . $from;
     // load the e-mail addresses of the users
     $users =& user_get_objects($monitor_ids);
     if (count($users) > 0) {
         foreach ($users as $user) {
             if ($user->getStatus() == "A") {
                 //we are only sending emails to active users
                 $emails[] = $user->getEmail();
             }
         }
     }
     //		print($body);
     //now remove all duplicates from the email list
     if (count($emails) > 0) {
         $BCC = implode(',', array_unique($emails));
         util_send_message('', $subject, $body, $from, $BCC, '', $extra_headers);
     }
     //util_handle_message($monitor_ids,$subject,$body,$BCC);
     return true;
 }
 function renderAssigneeList($assignee_ids)
 {
     $techs =& user_get_objects($assignee_ids);
     for ($i = 0; $i < count($techs); $i++) {
         $return .= $techs[$i]->getRealName() . '<br />';
     }
     return $return;
 }
Esempio n. 6
0
 /**
  * getAdmins() - Get array of Admin user objects.
  *
  *	@return	array	Array of User objects.
  */
 function &getAdmins()
 {
     // this function gets all group admins in order to send Jabber and mail messages
     $q = "SELECT user_id FROM user_group WHERE admin_flags = 'A' AND group_id = " . $this->getID();
     $res = db_query($q);
     $user_ids = util_result_column_to_array($res);
     return user_get_objects($user_ids);
 }
Esempio n. 7
0
    exit_error('Error', 'Could Not Get ProjectTaskFactory');
} elseif ($ptf->isError()) {
    exit_error('Error', $ptf->getErrorMessage());
}
$ptf->order = 'external_id';
$pt_arr =& $ptf->getTasks();
if ($ptf->isError()) {
    exit_error('Error', $ptf->getErrorMessage());
}
//
//	Iterate the array of tasks and dump them out to a comma-separated file
//
$arrRemove = array("\r\n", "\n", ',');
for ($i = 0; $i < count($pt_arr); $i++) {
    echo $pt_arr[$i]->getID() . ',' . $pt_arr[$i]->getExternalID() . ',' . $pt_arr[$i]->getParentID() . ',' . ',' . str_replace($arrRemove, ' ', $pt_arr[$i]->getSummary()) . ',' . $pt_arr[$i]->getDuration() . ',' . $pt_arr[$i]->getHours() . ',' . date('Y-m-d H:i:s', $pt_arr[$i]->getStartDate()) . ',' . date('Y-m-d H:i:s', $pt_arr[$i]->getEndDate()) . ',' . $pt_arr[$i]->getPercentComplete() . ',' . $pt_arr[$i]->getPriority() . ',' . str_replace($arrRemove, ' ', $pt_arr[$i]->getDetails()) . ',';
    $users =& user_get_objects($pt_arr[$i]->getAssignedTo());
    for ($j = 0; $j < 5; $j++) {
        if ($j < count($users)) {
            if ($users[$j]->getUnixName() != 'none') {
                echo $users[$j]->getUnixName();
            }
        }
        echo ',';
    }
    $dependentOn =& $pt_arr[$i]->getDependentOn();
    $keys = array_keys($dependentOn);
    for ($j = 0; $j < 5; $j++) {
        if ($j < count($keys)) {
            echo $keys[$j] . ',,' . $dependentOn[$keys[$j]];
        } else {
            echo ',,';
Esempio n. 8
0
 public function getUsersByAllowedAction($section, $reference, $action = NULL)
 {
     $roles = $this->getRolesByAllowedAction($section, $reference, $action);
     $user_ids = array();
     foreach ($roles as $role) {
         foreach ($role->getUsers() as $user) {
             $user_ids[] = $user->getID();
         }
     }
     $user_ids = array_unique($user_ids);
     return user_get_objects($user_ids);
 }
 /**
  *  getTechnicianObjects - Array of User objects set up for this artifact type.
  *
  *  @return array   Of User objects.
  */
 function &getTechnicianObjects()
 {
     $res = $this->getTechnicians();
     $arr =& util_result_column_to_array($res, 0);
     return user_get_objects($arr);
 }