Example #1
0
 public function display()
 {
     global $mod_strings;
     if ($_REQUEST['return_module'] == 'Project') {
         $project = new Project();
         $project->retrieve($_REQUEST['return_id']);
         //Get project resources (users & contacts)
         $resources1 = $project->get_linked_beans('project_users_1', 'User');
         $resources2 = $project->get_linked_beans('project_contacts_1', 'Contact');
         //sort into descending order
         ksort($resources1);
         ksort($resources2);
         echo "<script type='text/javascript'>";
         echo "var users = [];";
         echo "var contacts = [];";
         foreach ($resources1 as $user) {
             echo "var user = ['" . $user->id . "', '" . $user->name . "', 'User'];";
             echo "users.push(user);";
         }
         foreach ($resources2 as $contact) {
             echo "var user = ['" . $contact->id . "', '" . $contact->name . "', 'Contact'];";
             echo "contacts.push(user);";
         }
         echo "</script>";
     }
     parent::display();
 }
Example #2
0
 function display()
 {
     $this->ev->process();
     //echo "<!-- \n";
     //var_dump($_REQUEST);
     //var_dump($this->ev->fieldDefs);
     //echo "-->";
     if (empty($this->ev->focus->id) && $_REQUEST['return_relationship'] == 'projects_cases') {
         $parent = new Project();
         $parent->retrieve($_REQUEST['return_id']);
         $accts = $parent->get_linked_beans('accounts', 'Account');
         $i = 0;
         $acctlist = array();
         foreach ($accts as $acct) {
             $acctlist[i] = $acct->id;
             $i++;
         }
         if (isset($parent->facility_c) && $this->ev->fieldDefs['jobnumber_c']['value'] == "") {
             $this->ev->fieldDefs['jobnumber_c']['value'] = $parent->jobnumber_c;
         }
         if ($i > 0 && $this->ev->fieldDefs['account_id']['value'] == "") {
             $this->ev->fieldDefs['account_id']['value'] = $acct->id;
             $this->ev->fieldDefs['account_name']['value'] = $acct->name;
         }
     }
     echo $this->ev->display();
 }
Example #3
0
    public function display()
    {
        global $db, $mod_strings, $app_list_strings;
        echo '<link rel="stylesheet" type="text/css" href="custom/modules/Project/css/style.css" />';
        echo '<link rel="stylesheet" type="text/css" href="custom/modules/Project/qtip/jquery.qtip.min.css" />';
        echo '<script type="text/javascript" src="custom/modules/Project/js/main_lib.js"></script>';
        echo '<script type="text/javascript" src="custom/modules/Project/js/splitter.js"></script>';
        echo '<script type="text/javascript" src="custom/modules/Project/js/jquery.blockUI.js"></script>';
        echo '<script type="text/javascript" src="custom/modules/Project/js/jquery.validate.min.js"></script>';
        $project = new Project();
        $project->retrieve($_REQUEST["project_id"]);
        //Get project resources (users & contacts)
        $resources1 = $project->get_linked_beans('project_users_1', 'User');
        $resources2 = $project->get_linked_beans('project_contacts_1', 'Contact');
        //Combine resources into array of objects
        $resource_array = array();
        foreach ($resources1 as $user) {
            $resource = new stdClass();
            $resource->id = $user->id;
            $resource->name = $user->name;
            $resource->type = 'user';
            $resource_array[] = $resource;
        }
        foreach ($resources2 as $contact) {
            $resource = new stdClass();
            $resource->id = $contact->id;
            $resource->name = $contact->name;
            $resource->type = 'contact';
            $resource_array[] = $resource;
        }
        //Get the start and end date of the project in database format
        $query = "SELECT estimated_start_date FROM project WHERE id = '{$project->id}'";
        $start_date = $db->getOne($query);
        $query = "SELECT estimated_end_date FROM project WHERE id = '{$project->id}'";
        $end_date = $db->getOne($query);
        ?>
        <!--Create task pop-up-->
        <div style="display: none;">
            <div id="dialog" title="<?php 
        echo $mod_strings['LBL_ADD_NEW_TASK'];
        ?>
">
                <p>
                    <?php 
        echo $mod_strings['LBL_EDIT_TASK_PROPERTIES'];
        ?>
                </p>

                <form id="popup_form">
                    <fieldset>
                        <input type="hidden" name="project_id" id="project_id" value="<?php 
        echo $project->id;
        ?>
">
                        <input type="text" style="display: none;" name="task_id" id="task_id" value="">
                        <input type="radio" name="Milestone" value="Subtask" checked="checked" id="Subtask"/>
                        <label id="Subtask_label" for="Subtask"><?php 
        echo $mod_strings['LBL_SUBTASK'];
        ?>
</label>
                        <input type="radio" name="Milestone" value="Milestone" id="Milestone"/>
                        <label id="Milestone_label"
                               for="Milestone"><?php 
        echo $mod_strings['LBL_MILESTONE_FLAG'];
        ?>
</label>&nbsp;<br/><br/>
                        <label id="parent_task_id" for="parent_task"
                               style="display: none;"><?php 
        echo $mod_strings['LBL_PARENT_TASK_ID'];
        ?>
</label>
                        <input id="parent_task" class="text ui-widget-content ui-corner-all" style="display: none;"
                               type="text" name="parent_task" value=""/>
                        <label for="name"><?php 
        echo $mod_strings['LBL_TASK_NAME'];
        ?>
</label>
                        <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all"/>
                        <label for="Predecessor"><?php 
        echo $mod_strings['LBL_PREDECESSORS'];
        ?>
</label>
                        <?php 
        echo '<select id="Predecessor" name="Predecessor" class="text ui-widget-content ui-corner-all" />';
        /* foreach ($tasks as $task) {
               echo '<option rel="'.$task->id.'" value="'.$task->order_number.'">'.$task->name.'</opion>';
           }*/
        echo '</select>';
        ?>
                        <label for="relation_type"><?php 
        echo $mod_strings['LBL_RELATIONSHIP_TYPE'];
        ?>
</label>
                        <?php 
        echo '<select id="relation_type" name="relation_type" class="text ui-widget-content ui-corner-all">
                                ' . get_select_options_with_id($app_list_strings['relationship_type_list'], '') . '
                        </select>';
        ?>
                        <label for="Lag"><?php 
        echo $mod_strings['LBL_LAG'];
        ?>
</label>
                        <input type="text" name="Lag" value="0" id="Lag" class="text ui-widget-content ui-corner-all"/>
                        <select id="Lag_unit" name="Lag_unit" class="text ui-widget-content ui-corner-all"/>
                        <option value="Days"><?php 
        echo $mod_strings['LBL_DAYS'];
        ?>
</option>
                        <!-- <option value="Hours">--><?php 
        //echo $mod_strings['LBL_HOURS'];
        ?>
<!--</option>-->
                        </select>
                        <label for="start"><?php 
        echo $mod_strings['LBL_START'];
        ?>
</label>
                        <input type="text" name="Start" id="Start" value=""
                               class="text ui-widget-content ui-corner-all"/>
                        <script type="text/javascript">
                            var now = new Date();
                            Calendar.setup({
                                inputField: "Start",
                                ifFormat: cal_date_format,
                                daFormat: "%m/%d/%Y %I:%M%P",
                                button: "Start",
                                singleClick: true,
                                step: 1,
                                weekNumbers: false,
                                startWeekday: 0
                            });
                        </script>
                        <label for="Duration"><?php 
        echo $mod_strings['LBL_DURATION_TITLE'];
        ?>
</label>
                        <input type="text" name="Duration" id="Duration" class="text ui-widget-content ui-corner-all"/>
                        <select id="Duration_unit" name="Duration_unit" class="text ui-widget-content ui-corner-all"/>
                        <?php 
        echo get_select_options_with_id($app_list_strings['duration_unit_dom'], '');
        ?>
                        </select>
                        <label for="Resources"><?php 
        echo $mod_strings['LBL_ASSIGNED_USER_ID'];
        ?>
</label>
                        <?php 
        echo '<select id="Resources" name="Resources" class="text ui-widget-content ui-corner-all" />';
        echo '<option value="0">' . $mod_strings['LBL_UNASSIGNED'] . '</option>';
        foreach ($resource_array as $resource) {
            echo '<option rel="' . $resource->type . '" value="' . $resource->id . '">' . $resource->name . '</opion>';
        }
        echo '</select>';
        ?>
                        <label for="%Complete"><?php 
        echo $mod_strings['LBL_PERCENT_COMPLETE'];
        ?>
</label>
                        <input type="text" name="Complete" id="Complete" value="0"
                               class="text ui-widget-content ui-corner-all"/>
                        <label for="Actual_duration"><?php 
        echo $mod_strings['LBL_ACTUAL_DURATION'];
        ?>
</label>
                        <input type="text" name="Actual_duration" id="Actual_duration" value=""
                               class="text ui-widget-content ui-corner-all"/>
                        <label for="Notes"><?php 
        echo $mod_strings['LBL_DESCRIPTION'];
        ?>
</label>
                        <textarea id="Notes" cols="34" name="Notes"
                                  class="text ui-widget-content ui-corner-all"></textarea>
                    </fieldset>
                </form>
            </div>
            <!--Delete task pop-up-->
            <div id="delete_dialog" title="<?php 
        echo $mod_strings['LBL_DELETE_TASK'];
        ?>
">
                <p>
                    Are you sure you want to delete this task?
                </p>
            </div>
        </div>
        <!-- Pop-up End -->


        <!--Mark-up for the main body of the view-->
        <div id="wrapper">
            <table id="header_table">
                <tr>
                    <td colspan="4"><h2><a title="<?php 
        echo $mod_strings['LBL_PROJECT_TITLE_HOVER'];
        ?>
"
                                           href="index.php?module=Project&action=DetailView&record=<?php 
        echo $project->id;
        ?>
"><?php 
        echo $project->name;
        ?>
</a>
                        </h2></td>
                </tr>
                <tr>
                    <td class="heading"><?php 
        echo $mod_strings['LBL_START'];
        ?>
</td>
                    <td><?php 
        echo $project->estimated_start_date;
        ?>
</td>
                    <td class="heading"><?php 
        echo $mod_strings['LBL_FINISH'];
        ?>
</td>
                    <td><?php 
        echo $project->estimated_end_date;
        ?>
</td>
                </tr>
                <tr>
                    <td class="heading"><?php 
        echo $mod_strings['LBL_VIEW_GANTT_DURATION'];
        ?>
</td>
                    <td><?php 
        echo $this->time_range($start_date, $end_date);
        ?>
</td>
                    <td class="heading"><?php 
        echo $mod_strings['LBL_STATUS'];
        ?>
</td>
                    <td><?php 
        echo $app_list_strings['project_status_dom'][$project->status];
        ?>
</td>
                </tr>
                <tr>
                    <td class="heading"><?php 
        echo $mod_strings['LBL_ASSIGNED_USER_NAME'];
        ?>
</td>
                    <td><?php 
        echo $project->assigned_user_name;
        ?>
</td>
                    <td class="heading"><?php 
        echo $mod_strings['LBL_PRIORITY'];
        ?>
</td>
                    <td><?php 
        echo $app_list_strings['projects_priority_options'][$project->priority];
        ?>
</td>
                </tr>
                <tr>
                    <td class="heading"><?php 
        echo $mod_strings['LBL_DESCRIPTION'];
        ?>
</td>
                    <td colspan="3"><?php 
        echo $project->description;
        ?>
</td>
                </tr>
                <tr>
                    <td class="header_gap" colspan="4">
                        <span id="exportToPDFSpan">
                            <?php 
        if (ACLController::checkAccess('Project', 'edit', true)) {
            echo '<button id="add_button" class="gantt_button">Add New Task</button>';
            echo '<input id="is_editable" name="is_editable" type="hidden" value="1" >';
        }
        ?>
                        </span>
                    </td>
                </tr>
            </table>
            <input id="project_id" type="hidden" name="project_id" value="<?php 
        echo $_REQUEST["project_id"];
        ?>
"/>

            <div id="project_wrapper">


            </div>
        </div>
        <!--Main body end-->
    <?php 
    }
Example #4
0
 public function draw($tasks)
 {
     global $mod_strings, $app_list_strings;
     // Instantiate the TimeDate Class
     $timeDate = new TimeDate();
     echo '<table id="Task_table" class="project_table_header">
             <tr class="disable_sort">
                 <td style="min-width:32px;" class="project_table_headings">' . $mod_strings['LBL_TASK_ID'] . '</td>
                 <td style="min-width:85px;" class="project_table_headings">' . $mod_strings['LBL_TASK_NAME'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_PREDECESSORS'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_START'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_FINISH'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_DURATION'] . '</td>
                 <td style="min-width:120px;" class="project_table_headings">' . $mod_strings['LBL_ASSIGNED_USER_ID'] . '</td>
                 <td style="min-width:48px;" class="project_table_headings">' . $mod_strings['LBL_PERCENT_COMPLETE'] . '</td>
                 <td style="min-width:80px;" class="project_table_headings">' . $mod_strings['LBL_MILESTONE_FLAG'] . '</td>
                 <td style="min-width:80px;" class="project_table_headings">' . $mod_strings['LBL_ACTUAL_DURATION'] . '</td>
                 <td style="min-width:30px;" class="project_table_headings"></td>
             </tr>
     ';
     $task_count = 0;
     if (!is_null($tasks)) {
         foreach ($tasks as $task) {
             //Get resources
             $project = new Project();
             $project->retrieve($task->project_id);
             //Get project resources (users & contacts)
             $resources1 = $project->get_linked_beans('project_users_1', 'User');
             $resources2 = $project->get_linked_beans('project_contacts_1', 'Contact');
             //Combine resources into array of objects
             $resource_array = array();
             foreach ($resources1 as $user) {
                 $resource = new stdClass();
                 $resource->id = $user->id;
                 $resource->name = $user->name;
                 $resource->type = 'user';
                 $resource_array[] = $resource;
             }
             foreach ($resources2 as $contact) {
                 $resource = new stdClass();
                 $resource->id = $contact->id;
                 $resource->name = $contact->name;
                 $resource->type = 'contact';
                 $resource_array[] = $resource;
             }
             echo '<tr class="row_sortable">
                     <td class="project_table_cells"><input class="order_number" name="order_number[]" rel="' . $task->id . '" type="hidden" value="' . $task->order_number . '" />' . $task->project_task_id . '</td>';
             if (ACLController::checkAccess('Project', 'edit', true)) {
                 echo '<td class="project_table_cells" ><span class="Task_name" ><a data = "' . $task->id . ',' . $task->predecessors . ',' . $task->relationship_type . ',' . $timeDate->to_display_date($task->date_start, true) . ',' . $task->duration . ',' . $task->duration_unit . ',' . $task->assigned_user_id . ',' . $task->milestone_flag . ',' . $task->percent_complete . ',' . $task->description . ',' . $task->actual_duration . '" onclick = "edit_task($(this));"title = "' . $mod_strings['LBL_TASK_TITLE'] . '" href = "#" > ' . $task->name . '</a ></span ></td>';
             } else {
                 echo '<td class="project_table_cells" ><span class="Task_name" >' . $task->name . '</span ></td>';
             }
             echo '<td class="project_table_cells">';
             foreach ($tasks as $predecessor) {
                 if ($predecessor->project_task_id == $task->predecessors) {
                     echo $predecessor->name;
                 }
             }
             echo '
                     </td>
                     <td class="project_table_cells">' . $timeDate->to_display_date($task->date_start, true) . '</td>
                     <td class="project_table_cells">' . $timeDate->to_display_date($task->date_finish, true) . '</td>
                     <td class="project_table_cells">' . $task->duration . ' ' . $app_list_strings['duration_unit_dom'][$task->duration_unit] . '</td>
                     <td style="min-width:105px;" class="project_table_cells" >';
             $rflag = '0';
             foreach ($resource_array as $resource) {
                 if ($resource->id == $task->assigned_user_id) {
                     if ($resource->type == 'user') {
                         echo '<a target="blank" href="index.php?module=Users&action=DetailView&record=' . $resource->id . '">' . $resource->name . '</a>';
                         $rflag = '1';
                     } elseif ($resource->type == 'contact') {
                         echo '<a target="blank" href="index.php?module=Contacts&action=DetailView&record=' . $resource->id . '">' . $resource->name . '</a>';
                         $rflag = '1';
                     }
                 }
             }
             if ($rflag == '0') {
                 echo $mod_strings['LBL_UNASSIGNED'];
             }
             if ($task->milestone_flag == '1') {
                 $checked = $app_list_strings['checkbox_dom']['1'];
             } else {
                 $checked = $app_list_strings['checkbox_dom']['2'];
             }
             echo '</td>
                     <td class="project_table_cells">' . $task->percent_complete . '</td>
                     <td class="project_table_cells">' . $checked . '</td>
                     <td class="project_table_cells">' . $task->actual_duration . '</td>
                     <td class="project_table_cells">
                         <span id="exportToPDFSpan">';
             if (ACLController::checkAccess('Project', 'delete', true)) {
                 echo '<button style = "height:20px;width:20px;" class="remove_button" value = "' . $task->id . '" class="gantt_button" > Delete Task </button >';
             } else {
                 echo '<button disabled="disabled" style = "height:20px;width:20px;" class="remove_button" value = "' . $task->id . '" class="gantt_button" > Delete Task </button >';
             }
             echo '</span>
                      </td>
                 </tr>';
             $task_count++;
         }
     }
     echo '</table>';
 }