Beispiel #1
0
<?php

$lc = new listingController('tasks', $url_params, $sf_request, $sf_user);
$extra_fields = ExtraFieldsList::getFieldsByType('tasks', $sf_user);
$totals = array();
$totals['EstimatedTime'] = 0;
$totals['WorkHours'] = 0;
$is_filter = array();
$is_filter['TasksPriority'] = app::countItemsByTable('TasksPriority');
$is_filter['TasksLabels'] = app::countItemsByTable('TasksLabels');
$is_filter['TasksStatus'] = app::countItemsByTable('TasksStatus');
$is_filter['TasksTypes'] = app::countItemsByTable('TasksTypes');
$is_filter['TasksGroups'] = app::countItemsByTable('TasksGroups', $sf_request->getParameter('projects_id'));
$is_filter['Versions'] = app::countItemsByTable('Versions', $sf_request->getParameter('projects_id'));
$is_filter['ProjectsPhases'] = app::countItemsByTable('ProjectsPhases', $sf_request->getParameter('projects_id'));
$in_listing = explode(',', sfConfig::get('app_tasks_columns_list'));
foreach ($is_filter as $k => $v) {
    if ($v == 0 and array_search($k, $in_listing) > 0) {
        unset($in_listing[array_search($k, $in_listing)]);
    }
}
$cols = 1;
$has_comments_access = Users::hasAccess('view', 'tasksComments', $sf_user);
?>
   

<table width="100%">
  <tr>
    <td>
      <table>
        <tr>
Beispiel #2
0
 public function executeExport(sfWebRequest $request)
 {
     $this->columns = array('id' => t::__('Id'), 'UsersGroups' => t::__('Group'), 'name' => t::__('Name'), 'email' => t::__('Email'));
     $extra_fields = ExtraFieldsList::getFieldsByType('users', $this->getUser(), false, array('all' => true));
     foreach ($extra_fields as $v) {
         $this->columns['extra_field_' . $v['id']] = $v['name'];
     }
     if ($fields = $request->getParameter('fields')) {
         $separator = "\t";
         $format = $request->getParameter('format', '.csv');
         $filename = $request->getParameter('filename', 'users');
         header("Content-type: Application/octet-stream");
         header("Content-disposition: attachment; filename=" . $filename . "." . $format);
         header("Pragma: no-cache");
         header("Expires: 0");
         $content = '';
         foreach ($fields as $f) {
             $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $this->columns[$f]) . $separator;
         }
         $content .= "\n";
         if ($format == 'csv') {
             echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
         } else {
             echo $content;
         }
         if (strlen($request->getParameter('selected_items') == 0)) {
             exit;
         }
         $q = Doctrine_Core::getTable('Users')->createQuery('u')->leftJoin('u.UsersGroups ug')->whereIn('u.id', explode(',', $request->getParameter('selected_items')));
         $users = $q->orderBy('ug.name, u.name')->fetchArray();
         foreach ($users as $u) {
             $ex_values = ExtraFieldsList::getValuesList($extra_fields, $u['id']);
             $content = '';
             foreach ($fields as $f) {
                 $v = '';
                 if (in_array($f, array('id', 'name', 'email'))) {
                     $v = $u[$f];
                 } elseif (strstr($f, 'extra_field_')) {
                     if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
                         $v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
                         $v = str_replace('<br>', ', ', $v);
                     }
                 } else {
                     $v = app::getArrayName($u, $f);
                 }
                 $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
             }
             $content .= "\n";
             if ($format == 'csv') {
                 echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
             } else {
                 echo $content;
             }
         }
         exit;
     }
 }
Beispiel #3
0
 public static function renderFormFileds($bind_type, $object, $sf_user, $extra_fields = null)
 {
     if ($extra_fields === null) {
         $extra_fields = ExtraFieldsList::getFieldsByType($bind_type, $sf_user);
     }
     if ($bind_type == 'events') {
         $values = ExtraFieldsList::getValuesList($extra_fields, $object ? $object->getEventId() : false);
     } else {
         $values = ExtraFieldsList::getValuesList($extra_fields, $object ? $object->getId() : false);
     }
     $html = '';
     foreach ($extra_fields as $v) {
         if ($v['type'] == 'formula') {
             continue;
         }
         $html .= '
     <tr id="extra_field_row_' . $v['id'] . '" class="extra_field_row">
       <th>' . $v['name'] . ($v['type'] == 'checkbox' ? '<br><a href="#" onClick="return checkAllInContainer(\'checkboxesList' . $v['id'] . '\')"><small>' . __('Select All') . '</small></a>' : '') . '</th>
       <td>' . ExtraFieldsList::renderFormFieldByType($v, $values) . '</td>
     </tr>';
     }
     return $html;
 }
Beispiel #4
0
<?php

$lc = new listingController('projects', $url_params, $sf_request, $sf_user);
$extra_fields = ExtraFieldsList::getFieldsByType('projects', $sf_user);
$totals = array();
$is_filter = array();
$is_filter['status'] = app::countItemsByTable('ProjectsStatus');
$is_filter['type'] = app::countItemsByTable('ProjectsTypes');
$has_comments_access = Users::hasAccess('view', 'projectsComments', $sf_user);
?>
   

<table width="100%">
  <tr>
    <td>
      <table>
        <tr>
          <?php 
if ($display_insert_button) {
    ?>
          <td style="padding-right: 15px;"><?php 
    echo $lc->insert_button(__('Add Project'));
    ?>
</td>
          <?php 
}
?>
          <td style="padding-right: 15px;"><div id="tableListingMultipleActionsMenu"><?php 
echo $lc->rednerWithSelectedAction($tlId);
?>
</div></td>
Beispiel #5
0
 public function executeExport(sfWebRequest $request)
 {
     /*check access*/
     if ($request->hasParameter('projects_id')) {
         $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id')));
         $this->checkProjectsAccess($this->projects);
         $this->checkTicketsAccess('view', false, $this->projects);
     } else {
         $this->checkTicketsAccess('view');
     }
     $this->columns = array('Projects' => t::__('Project Name'), 'id' => t::__('Id'), 'TicketsStatus' => t::__('Status'), 'TicketsTypes' => t::__('Type'), 'name' => t::__('Name'), 'description' => t::__('Description'), 'Departments' => t::__('Department'), 'Users' => t::__('Created By'), 'created_at' => t::__('Created At'));
     $extra_fields = ExtraFieldsList::getFieldsByType('tickets', $this->getUser(), false, array('all' => true));
     foreach ($extra_fields as $v) {
         $this->columns['extra_field_' . $v['id']] = $v['name'];
     }
     if (!$request->hasParameter('projects_id')) {
         $this->columns['Projects'] = t::__('Project');
     }
     $this->columns['Projects'] = t::__('Project Name');
     $this->columns['url'] = t::__('Url');
     if ($fields = $request->getParameter('fields')) {
         $separator = "\t";
         $format = $request->getParameter('format', '.csv');
         $filename = $request->getParameter('filename', 'tasks');
         header("Content-type: Application/octet-stream");
         header("Content-disposition: attachment; filename=" . $filename . "." . $format);
         header("Pragma: no-cache");
         header("Expires: 0");
         $content = '';
         foreach ($fields as $f) {
             $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $this->columns[$f]) . $separator;
         }
         $content .= "\n";
         if ($format == 'csv') {
             echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
         } else {
             echo $content;
         }
         if (strlen($request->getParameter('selected_items') == 0)) {
             exit;
         }
         $q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users')->whereIn('t.id', explode(',', $request->getParameter('selected_items')));
         if ($request->hasParameter('projects_id')) {
             $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
             if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
                 $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
             }
         } else {
             if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
                 $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.users_id='" . $this->getUser()->getAttribute('id') . "'");
             }
             if (Users::hasAccess('view_own', 'tickets', $this->getUser())) {
                 $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
             }
         }
         if ($request->hasParameter('projects_id')) {
             $q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
         } else {
             $q->orderBy('LTRIM(p.name), ts.sort_order, LTRIM(ts.name), LTRIM(t.name)');
         }
         $tickets = $q->fetchArray();
         $totals = array();
         $projects_totals = array();
         $current_project_id = 0;
         foreach ($tickets as $t) {
             $ex_values = ExtraFieldsList::getValuesList($extra_fields, $t['id']);
             $content = '';
             //
             if ($current_project_id == 0) {
                 $current_project_id = $t['projects_id'];
             }
             if ($current_project_id != $t['projects_id']) {
                 //adding totals
                 if (isset($projects_totals[$current_project_id])) {
                     foreach ($fields as $f) {
                         $v = '';
                         if (strstr($f, 'extra_field_')) {
                             if (isset($projects_totals[$current_project_id][str_replace('extra_field_', '', $f)])) {
                                 $v = $projects_totals[$current_project_id][str_replace('extra_field_', '', $f)];
                             }
                         }
                         $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
                     }
                     $content .= "\n\n";
                 }
                 $current_project_id = $t['projects_id'];
             }
             foreach ($fields as $f) {
                 $v = '';
                 if (in_array($f, array('id', 'name', 'description'))) {
                     $v = $t[$f];
                 } elseif (strstr($f, 'extra_field_')) {
                     if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
                         $v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
                         if (in_array($ex->getType(), array('number', 'formula'))) {
                             if (!isset($totals[$ex->getId()])) {
                                 $totals[$ex->getId()] = 0;
                             }
                             if (!isset($projects_totals[$t['projects_id']][$ex->getId()])) {
                                 $projects_totals[$t['projects_id']][$ex->getId()] = 0;
                             }
                             $totals[$ex->getId()] += $v;
                             $projects_totals[$t['projects_id']][$ex->getId()] += $v;
                         }
                         $v = str_replace('<br>', ', ', $v);
                     }
                 } elseif ($f == 'created_at') {
                     if (strlen($t[$f]) > 0) {
                         $v = app::dateTimeFormat($t[$f]);
                     }
                 } elseif ($f == 'url') {
                     $v = app::public_url('ticketsComments/index?projects_id=' . $t['projects_id'] . '&tickets_id=' . $t['id']);
                 } else {
                     $v = app::getArrayName($t, $f);
                 }
                 $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
             }
             $content .= "\n";
             if ($format == 'csv') {
                 echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
             } else {
                 echo $content;
             }
         }
         $content = '';
         //adding totals
         if (isset($projects_totals[$current_project_id]) and !$request->hasParameter('projects_id')) {
             foreach ($fields as $f) {
                 $v = '';
                 if (strstr($f, 'extra_field_')) {
                     if (isset($projects_totals[$current_project_id][str_replace('extra_field_', '', $f)])) {
                         $v = $projects_totals[$current_project_id][str_replace('extra_field_', '', $f)];
                     }
                 }
                 $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
             }
             $content .= "\n\n";
         }
         foreach ($fields as $f) {
             $v = '';
             if (strstr($f, 'extra_field_')) {
                 if (isset($totals[str_replace('extra_field_', '', $f)])) {
                     $v = $totals[str_replace('extra_field_', '', $f)];
                 }
             }
             $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
         }
         $content .= "\n";
         if ($format == 'csv') {
             echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
         } else {
             echo $content;
         }
         exit;
     }
 }
Beispiel #6
0
?>
</td>
  </tr>  
</table>
</div>

<div><?php 
if (!$sf_request->hasParameter('search')) {
    include_component('users', 'filtersPreview');
}
?>
</div>

<?php 
$lc = new cfgListingController($sf_context->getModuleName());
$extra_fields = ExtraFieldsList::getFieldsByType('users', $sf_user, true);
?>


<table width="100%">
  <tr>
    <td>
      <table>
        <tr>          
          <td style="padding-right: 15px;"><?php 
echo $lc->insert_button(__('Add User'));
?>
</td>                    
          <td style="padding-right: 15px;"><?php 
echo link_to_mmodalbox(__('Export Selected'), 'users/export');
?>
Beispiel #7
0
 public function executeXlsTasksImportBindField(sfWebRequest $request)
 {
     $this->columns = array('TasksGroups' => t::__('Group'), 'Versions' => t::__('Version'), 'ProjectsPhases' => t::__('Phase'), 'TasksPriority' => t::__('Priority'), 'TasksLabels' => t::__('Label'), 'name' => t::__('Name'), 'TasksStatus' => t::__('Status'), 'TasksTypes' => t::__('Type'), 'assigned_to' => t::__('Assigned To'), 'estimated_time' => t::__('Est. Time'), 'start_date' => t::__('Start Date'), 'due_date' => t::__('Due Date'), 'progress' => t::__('Progress'));
     $extra_fields = ExtraFieldsList::getFieldsByType('tasks', $this->getUser(), false, array('all' => true));
     foreach ($extra_fields as $v) {
         $this->columns['extra_field_' . $v['id']] = $v['name'];
     }
     $import_fields = $this->getUser()->getAttribute('import_fields');
     foreach ($import_fields as $k => $v) {
         unset($this->columns[$v]);
     }
     if ($request->hasParameter('field_id')) {
         if ($request->getParameter('field_id') != '0') {
             $import_fields = $this->getUser()->getAttribute('import_fields');
             $import_fields[$request->getParameter('col')] = $request->getParameter('field_id');
             $this->getUser()->setAttribute('import_fields', $import_fields);
             echo $this->columns[$request->getParameter('field_id')];
         } else {
             $import_fields = $this->getUser()->getAttribute('import_fields');
             if (isset($import_fields[$request->getParameter('col')])) {
                 unset($import_fields[$request->getParameter('col')]);
             }
             $this->getUser()->setAttribute('import_fields', $import_fields);
             echo '-';
         }
         exit;
     }
 }
Beispiel #8
0
 public function executeExport(sfWebRequest $request)
 {
     /*check access*/
     Users::checkAccess($this, 'view', $this->getModuleName(), $this->getUser());
     $this->columns = array('id' => t::__('Id'), 'ProjectsStatus' => t::__('Status'), 'name' => t::__('Name'), 'description' => t::__('Description'), 'team' => t::__('Team'), 'ProjectsTypes' => t::__('Type'), 'Users' => t::__('Created By'), 'created_at' => t::__('Created At'));
     $extra_fields = ExtraFieldsList::getFieldsByType('projects', $this->getUser(), false, array('all' => true));
     foreach ($extra_fields as $v) {
         $this->columns['extra_field_' . $v['id']] = $v['name'];
     }
     $this->columns['url'] = t::__('Url');
     if ($fields = $request->getParameter('fields')) {
         $separator = "\t";
         $format = $request->getParameter('format', '.csv');
         $filename = $request->getParameter('filename', 'projects');
         header("Content-type: Application/octet-stream");
         header("Content-disposition: attachment; filename=" . $filename . "." . $format);
         header("Pragma: no-cache");
         header("Expires: 0");
         $content = '';
         foreach ($fields as $f) {
             $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $this->columns[$f]) . $separator;
         }
         $content .= "\n";
         if ($format == 'csv') {
             echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
         } else {
             echo $content;
         }
         if (strlen($request->getParameter('selected_items') == 0)) {
             exit;
         }
         $q = Doctrine_Core::getTable('Projects')->createQuery('p')->leftJoin('p.ProjectsStatus ps')->leftJoin('p.ProjectsTypes pt')->leftJoin('p.Users')->whereIn('p.id', explode(',', $request->getParameter('selected_items')));
         if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',p.team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
         $q = app::addListingOrder($q, 'projects', $this->getUser());
         $projects = $q->fetchArray();
         $totals = array();
         foreach ($projects as $p) {
             $ex_values = ExtraFieldsList::getValuesList($extra_fields, $p['id']);
             $content = '';
             foreach ($fields as $f) {
                 $v = '';
                 if (in_array($f, array('id', 'name', 'description'))) {
                     $v = $p[$f];
                 } elseif (strstr($f, 'extra_field_')) {
                     if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
                         $v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
                         if (in_array($ex->getType(), array('number', 'formula'))) {
                             if (!isset($totals[$ex->getId()])) {
                                 $totals[$ex->getId()] = 0;
                             }
                             $totals[$ex->getId()] += $v;
                         }
                         $v = str_replace('<br>', ', ', $v);
                     }
                 } elseif ($f == 'team') {
                     $v = Users::getNameById($p[$f], ', ');
                 } elseif ($f == 'created_at') {
                     if (strlen($p[$f]) > 0) {
                         $v = date(app::getDateTimeFormat(), app::getDateTimestamp($p[$f]));
                     }
                 } elseif ($f == 'url') {
                     $v = app::public_url('projectsComments/index?projects_id=' . $p['id']);
                 } else {
                     $v = app::getArrayName($p, $f);
                 }
                 $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
             }
             $content .= "\n";
             if ($format == 'csv') {
                 echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
             } else {
                 echo $content;
             }
         }
         $content = '';
         foreach ($fields as $f) {
             $v = '';
             if (strstr($f, 'extra_field_')) {
                 if (isset($totals[str_replace('extra_field_', '', $f)])) {
                     $v = $totals[str_replace('extra_field_', '', $f)];
                 }
             }
             $content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
         }
         $content .= "\n";
         if ($format == 'csv') {
             echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
         } else {
             echo $content;
         }
         exit;
     }
 }
Beispiel #9
0
 public function executeMultipleEdit(sfWebRequest $request)
 {
     if ($request->hasParameter('projects_id')) {
         $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id')));
         $this->checkProjectsAccess($this->projects);
         $this->checkTasksAccess('edit', false, $this->projects);
     } else {
         $this->checkTasksAccess('edit');
     }
     $this->fields = array();
     $this->numeric_fields = array();
     $choices = app::getItemsChoicesByTable('TasksPriority', true);
     if (count($choices) > 1) {
         $this->fields['tasks_priority_id'] = array('title' => t::__('Priority'), 'choices' => $choices);
     }
     $choices = app::getItemsChoicesByTable('TasksLabels', true);
     if (count($choices) > 1) {
         $this->fields['tasks_label_id'] = array('title' => t::__('Label'), 'choices' => $choices);
     }
     $choices = app::getItemsChoicesByTable('TasksStatus', true);
     if (count($choices) > 1) {
         $this->fields['tasks_status_id'] = array('title' => t::__('Status'), 'choices' => $choices);
     }
     $choices = app::getItemsChoicesByTable('TasksTypes', true);
     if (count($choices) > 1) {
         $this->fields['tasks_type_id'] = array('title' => t::__('Type'), 'choices' => $choices);
     }
     if ($request->hasParameter('projects_id')) {
         $choices = app::getItemsChoicesByTable('TasksGroups', true, $request->getParameter('projects_id'));
         if (count($choices) > 1) {
             $this->fields['tasks_groups_id'] = array('title' => t::__('Group'), 'choices' => $choices);
         }
         $choices = app::getItemsChoicesByTable('Versions', true, $request->getParameter('projects_id'));
         if (count($choices) > 1) {
             $this->fields['versions_id'] = array('title' => t::__('Version'), 'choices' => $choices);
         }
         $choices = app::getItemsChoicesByTable('ProjectsPhases', true, $request->getParameter('projects_id'));
         if (count($choices) > 1) {
             $this->fields['projects_phases_id'] = array('title' => t::__('Phase'), 'choices' => $choices);
         }
     }
     $this->fields['progress'] = array('title' => t::__('Progress'), 'choices' => Tasks::getProgressChoices());
     $extra_fields = ExtraFieldsList::getFieldsByType('tasks', $this->getUser(), false, array('all' => true));
     $this->numeric_fields['estimated_time'] = array('title' => t::__('Estimated Time'));
     foreach ($extra_fields as $v) {
         if (in_array($v['type'], array('number'))) {
             $this->numeric_fields['extra_field_' . $v['id']] = array('title' => $v['name']);
         }
     }
     if ($request->getParameter('fields')) {
         if (strlen($request->getParameter('selected_items') == 0)) {
             exit;
         }
         foreach ($request->getParameter('fields') as $key => $value) {
             if (strlen($value) == 0 and !is_array($value)) {
                 continue;
             }
             if ($key == 'tasks_status_id') {
                 foreach (explode(',', $request->getParameter('selected_items')) as $pid) {
                     if ($p = Doctrine_Core::getTable('Tasks')->find($pid)) {
                         if ($p->getTasksStatusId() != $value) {
                             $p->setTasksStatusId($value);
                             if (in_array($value, app::getStatusByGroup('closed', 'TasksStatus'))) {
                                 $p->setClosedDate(date('Y-m-d H:i:s'));
                             }
                             if (!in_array($value, app::getStatusByGroup('closed', 'TasksStatus'))) {
                                 $p->setClosedDate(null);
                             }
                             $p->save();
                             if (strlen($p->getAssignedTo()) > 0) {
                                 Tasks::sendNotification($this, $p, array('status' => explode(',', $p->getAssignedTo())), $this->getUser());
                             }
                             $c = new TasksComments();
                             $c->setTasksStatusId($value);
                             $c->setTasksId($pid);
                             $c->setCreatedAt(date('Y-m-d H:i:s'));
                             $c->setCreatedBy($this->getUser()->getAttribute('id'));
                             $c->save();
                         }
                     }
                 }
             } elseif ($key == 'estimated_time') {
                 $action_str = (double) $value;
                 if (in_array(substr($value, 0, 1), array('+', '-', '*', '/'))) {
                     $action_str = 'estimated_time ' . substr($value, 0, 1) . ' ' . (double) substr($value, 1);
                     Doctrine_Query::create()->update('Tasks')->set('estimated_time', 0)->whereIn('id', explode(',', $request->getParameter('selected_items')))->addWhere('estimated_time is null or length(estimated_time)=0')->execute();
                 }
                 Doctrine_Query::create()->update('Tasks')->set('estimated_time', $action_str)->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute();
             } elseif ($key == 'assigned_to') {
                 $tasks_list = Doctrine_Core::getTable('Tasks')->createQuery()->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute();
                 foreach ($tasks_list as $tasks) {
                     $tasks->setAssignedTo(implode(',', $value));
                     $tasks->save();
                     Tasks::sendNotification($this, $tasks, array('new' => $value), $this->getUser());
                     $c = new TasksComments();
                     $c->setDescription(t::__('Assigned To') . ': ' . Users::getNameById(implode(',', $value), ', '));
                     $c->setTasksId($tasks->getId());
                     $c->setCreatedAt(date('Y-m-d H:i:s'));
                     $c->setCreatedBy($this->getUser()->getAttribute('id'));
                     $c->save();
                     $tasks->save();
                 }
             } else {
                 Doctrine_Query::create()->update('Tasks')->set($key, $value)->whereIn('id', explode(',', $request->getParameter('selected_items')))->execute();
             }
         }
         $this->redirect_to($request->getParameter('redirect_to'), $request->getParameter('projects_id'), $request->getParameter('tasks_id'));
     }
 }
Beispiel #10
0
<?php

$lc = new listingController('discussions', $url_params, $sf_request, $sf_user);
$extra_fields = ExtraFieldsList::getFieldsByType('discussions', $sf_user);
$totals = array();
$is_filter = array();
$is_filter['status'] = app::countItemsByTable('DiscussionsStatus');
$has_comments_access = Users::hasAccess('view', 'discussionsComments', $sf_user);
?>

<table width="100%">
  <tr>
    <td>
      <table>
        <tr>
          <?php 
if ($display_insert_button) {
    ?>
          <td style="padding-right: 15px;"><?php 
    echo $lc->insert_button(__('Add Discussion'));
    ?>
</td>
          <?php 
}
?>
          <td style="padding-right: 15px;"><div id="tableListingMultipleActionsMenu"><?php 
echo $lc->rednerWithSelectedAction($tlId);
?>
</div></td>
          <td><?php 
echo count($discussions_list) > sfConfig::get('app_rows_per_page') ? get_partial('global/jsPager', array('id' => 'pager' . $tlId)) : '';