PHP User::getActiveProjects Examples

PHP User::getActiveProjects - 8 examples found. These are the top rated real world PHP examples of User::getActiveProjects extracted from open source projects. You can rate examples to help us improve the quality of examples.
 /**
  * Return the total hours by status and user
  *
  * @param User $user
  * @param Int $status
  * @param String $return one of 'times', 'hours'
  * @return array
  */
 static function getTimeByUserStatus(User $user, $status = 0, $return = 'times')
 {
     $projects = $user->getActiveProjects();
     if (!is_array($projects) || !count($projects)) {
         return 0;
     }
     // if
     $project_ids = array();
     foreach ($projects as $project) {
         $project_ids[] = $project->getId();
     }
     // foreach
     $order_by = $status ? '`done_date` DESC' : '`done_date` ASC';
     $times = self::findAll(array('conditions' => array('(`assigned_to_user_id` = ? OR (`assigned_to_user_id` = ? AND `assigned_to_company_id` = ?)) AND `is_closed` = ? AND `project_id` IN (?)', $user->getId(), 0, 0, $status, $project_ids), 'order' => $order_by));
     // findAll
     if ($return == 'times') {
         return $times;
     }
     // if
     $hours = 0;
     if (!is_array($times) && !count($times)) {
         return 0;
     }
     // if
     foreach ($times as $time) {
         $hours += $time->getHours();
     }
     // foreach
     return $hours;
 }
 /**
  * Return open tickets due in specified period
  *
  * @access public
  * @param User $user
  * @param DateTimeValue $from_date
  * @param DateTimeValue $to_date
  * @return array
  */
 function getOpenTicketsInPeriodByUser(User $user, DateTimeValue $from_date, DateTimeValue $to_date)
 {
     $projects = $user->getActiveProjects();
     if (!is_array($projects) || !count($projects)) {
         return null;
     }
     $project_ids = array();
     foreach ($projects as $project) {
         $project_ids[] = $project->getId();
     }
     // foreach
     // TODO status values hard-coded in query
     return self::findAll(array('conditions' => array('`state` IN (?) AND `project_id` IN (?)', array('new', 'open', 'pending'), $project_ids), 'order' => '`state` ASC'));
     // findAll
 }
Example #3
0
 public function action_index()
 {
     $session = Session::instance();
     //print_r(Company::checkIfApproved($session->get('userId')));
     //print_r($session);
     $projects = array();
     $projects = MyDB::getCompletedProjects();
     if ($session->get('userType') == 'student') {
         $projects = User::getActiveProjects($session->get('userId'));
     }
     if ($session->get('userType') == 'company') {
         $projects = Company::getActiveProjects($session->get('userId'));
     }
     $this->response->body(View::factory('header') . View::factory('welcome')->set('projects', $projects)->set('userType', $session->get('userType')));
 }
 /**
  * Return late tickets from active projects given user has access on.
  *
  * @param User $user
  * @return array or null
  */
 function getOpenTicketsByUser(User $user)
 {
     $due_date = DateTimeValueLib::now()->beginningOfDay();
     $projects = $user->getActiveProjects();
     if (!is_array($projects) || !count($projects)) {
         return null;
     }
     $project_ids = array();
     foreach ($projects as $project) {
         $project_ids[] = $project->getId();
     }
     // foreach
     return self::findAll(array('conditions' => array('`closed_on` = ? AND `project_id` IN (?)', EMPTY_DATETIME, $project_ids), 'order' => '`priority`'));
     // findAll
 }
 /**
  * Return all milestones that are assigned to the user
  *
  * @param User $user
  * @return array
  */
 static function getActiveMilestonesByUser(User $user, $archived = false)
 {
     $projects = $user->getActiveProjects();
     if (!is_array($projects) || !count($projects)) {
         return null;
     }
     // if
     $project_ids = array();
     foreach ($projects as $project) {
         $project_ids[] = $project->getId();
     }
     // foreach
     if ($archived) {
         $archived_cond = "`archived_by_id` <> 0 AND ";
     } else {
         $archived_cond = "`archived_by_id` = 0 AND ";
     }
     return self::findAll(array('conditions' => array('`is_template` = false AND (`assigned_to_user_id` = ? OR (`assigned_to_user_id` = ? AND `assigned_to_company_id` = ?)) AND ' . $archived_cond . self::getWorkspaceString($project_ids) . ' AND `completed_on` = ?', $user->getId(), 0, 0, EMPTY_DATETIME), 'order' => '`due_date`'));
     // findAll
 }
Example #6
0
    <?php 
require_once "header.php";
?>
     
     <?php 
if (isset($_SESSION['userType'])) {
    if ($_SESSION[userType] == 'student') {
        require_once "classes/userClass.php";
        $studentObj = new User();
        $projects = $studentObj->getActiveProjects($_SESSION['userID']);
        //print_r($projects);
        ?>
 
            <div id="main">
            <?php 
        foreach ($projects as $project) {
            ?>
                <div class="panel panel-success">
                    <div  class="panel-heading"><?php 
            echo $project['ProjectName'];
            ?>
</div>
                    <div class="panel-body"><?php 
            echo $project['Discription'];
            ?>
</div>
                    <div>
                    <?php 
            foreach ($project['SignedUp'] as $colegue) {
                ?>
                            <div class="panel-footer"> <?php 
 /**
  * Return active milestones due in specified period
  *
  * @access public
  * @param User $user
  * @param DateTimeValue $from_date
  * @param DateTimeValue $to_date
  * @return array
  */
 function getActiveMilestonesInPeriodByUser(User $user, DateTimeValue $from_date, DateTimeValue $to_date)
 {
     $projects = $user->getActiveProjects();
     if (!is_array($projects) || !count($projects)) {
         return null;
     }
     $project_ids = array();
     foreach ($projects as $project) {
         $project_ids[] = $project->getId();
     }
     // foreach
     return self::findAll(array('conditions' => array('`completed_on` = ? AND (`due_date` >= ? AND `due_date` < ?) AND `project_id` IN (?)', EMPTY_DATETIME, $from_date, $to_date, $project_ids), 'order' => '`due_date` ASC'));
     // findAll
 }
 /**
  * Return today milestones from active projects this user have access on
  *
  * @access public
  * @param void
  * @return array
  */
 function getTodayMilestonesByUser(User $user)
 {
     $from_date = DateTimeValueLib::now()->beginningOfDay();
     $to_date = DateTimeValueLib::now()->endOfDay();
     $projects = $user->getActiveProjects();
     if (!is_array($projects) || !count($projects)) {
         return null;
     }
     $project_ids = array();
     foreach ($projects as $project) {
         $project_ids[] = $project->getId();
     }
     // foreach
     return self::findAll(array('conditions' => array('`completed_on` = ? AND (`due_date` >= ? AND `due_date` < ?) AND `project_id` IN (?)', EMPTY_DATETIME, $from_date, $to_date, $project_ids)));
     // findAll
 }