Example #1
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $files = $request->getFiles();
     $userPhoto = $files['users']['photo']['name'];
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $user = $this->getUser()->getAttribute('user');
         $this->checkUser($form['email']->getValue(), $user->getId());
         $form->setFieldValue('users_group_id', $user->getUsersGroupId());
         $form->setFieldValue('active', $user->getActive());
         if (isset($form['new_password'])) {
             if (strlen($form['new_password']->getValue()) > 0) {
                 $form->setFieldValue('password', md5($form['new_password']->getValue()));
             }
         }
         if (strlen($userPhoto) > 0) {
             $userPhoto = rand(111111, 999999) . '-' . $userPhoto;
             $filename = sfConfig::get('sf_upload_dir') . '/users/' . $userPhoto;
             move_uploaded_file($files['users']['photo']['tmp_name'], $filename);
             $form->setFieldValue('photo', $userPhoto);
             app::image_resize($filename, $filename);
         } else {
             $form->setFieldValue('photo', $form['photo_preview']->getValue());
         }
         if ($form['remove_photo']->getValue() == 1 && strlen($form['photo_preview']->getValue()) > 0) {
             unlink(sfConfig::get('sf_upload_dir') . '/users/' . $form['photo_preview']->getValue());
             $form->setFieldValue('photo', '');
         }
         $users = $form->save();
         $this->getUser()->setAttribute('user', $users);
         $this->getUser()->setCulture($users->getCulture());
         ExtraFieldsList::setValues($request->getParameter('extra_fields'), $users->getId(), 'users', $this->getUser());
         $this->getUser()->setFlash('userNotices', t::__('Account Updated'));
         $this->redirect('myAccount/index');
     }
 }
Example #2
0
    echo '<tr><th>' . __('Group') . ':</th><td>' . $tasks->getTasksGroups()->getName() . '</td></tr>';
}
?>
  <?php 
if ($tasks->getProjectsPhasesId() > 0) {
    echo '<tr><th>' . __('Phase') . ':</th><td>' . $tasks->getProjectsPhases()->getName() . '</td></tr>';
}
?>
  <?php 
if ($tasks->getVersionsId() > 0) {
    echo '<tr><th>' . __('Version') . ':</th><td>' . $tasks->getVersions()->getName() . '</td></tr>';
}
?>
    
  <?php 
echo ExtraFieldsList::renderInfoFileds('tasks', $tasks, $sf_user);
?>
  
  <?php 
if ($tasks->getEstimatedTime() > 0) {
    echo '<tr><th>' . __('Estimated Time') . ':</th><td>' . $tasks->getEstimatedTime() . '</td></tr>';
}
?>
  <?php 
if (($work_hours = TasksComments::getTotalWorkHours($tasks->getId())) > 0) {
    $discrepancy = $tasks->getEstimatedTime() - $work_hours;
    echo '<tr><th>' . __('Work Hours') . ':</th><td>' . $work_hours . ($discrepancy < 0 ? ' <font color="#a23343">(' . $discrepancy . ')</font>' : ($discrepancy > 0 ? ' <font color="#32602f">(+' . $discrepancy . ')</font>' : '')) . '</td></tr>';
}
?>
    
  <?php 
Example #3
0



<table class="contentTable" style="width: 100%">
<tr>
  <td>
      
<div class="itemInfo taskInfo">
  <div class="itemInfoContainer">    
    <div class="itemDescription"><?php 
echo replaceTextToLinks($tasks->getDescription());
?>
</div>
    <div id="extraFieldsInDescription"><?php 
echo ExtraFieldsList::renderDescriptionFileds('tasks', $tasks, $sf_user);
?>
</div>
    <div><?php 
include_component('attachments', 'attachmentsList', array('bind_type' => 'tasks', 'bind_id' => $tasks->getId()));
?>
</div>
  </div>
</div>     
<br>

<?php 
echo input_hidden_tag('item_name', $tasks->getName()) . input_hidden_tag('item_description', $tasks->getDescription());
?>

<?php 
Example #4
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;
     }
 }
Example #5
0
    <td><?php 
echo $users->getUsersGroups()->getName();
?>
</td>
  </tr>
  <tr>
    <td><?php 
echo __('Email');
?>
:</td>
    <td><?php 
echo $users->getEmail();
?>
</td>
  </tr>
  <tr>
    <td><?php 
echo __('Photo');
?>
:</td>
    <td><?php 
echo renderUserPhoto($users->getPhoto());
?>
</td>
  </tr>
  
  <?php 
echo ExtraFieldsList::renderInfoFileds('users', $users, $sf_user);
?>
  
</table>  
Example #6
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;
     }
 }
Example #7
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;
 }
Example #8
0
      <td><?php 
    echo renderUserPhoto($users->getPhoto());
    ?>
</td>
      <td><?php 
    echo link_to_modalbox($users->getName(), 'users/info?id=' . $users->getId());
    ?>
</td>      
      <td><?php 
    echo $users->getEmail();
    ?>
</td>  
      
      <?php 
    $v = ExtraFieldsList::getValuesList($extra_fields, $users->getId());
    echo ExtraFieldsList::renderListingTbody($extra_fields, $v);
    ?>
                
      <td><?php 
    echo renderBooleanValue($users->getActive());
    ?>
</td>      
    </tr>
    <?php 
}
?>
    <?php 
if (sizeof($userss) == 0) {
    echo '<tr><td colspan="100">' . __('No Records Found') . '</td></tr>';
}
?>
Example #9
0
<table >
  <?php 
echo str_replace('</th>', ':&nbsp;</th>', ExtraFieldsList::renderInfoFileds('events', $events, $sf_user));
?>
  
</table>

<?php 
echo $events->getDetails();
?>

<div><?php 
include_component('attachments', 'attachmentsList', array('bind_type' => 'events', 'bind_id' => $events->getEventId()));
?>
</div>

Example #10
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;
     }
 }
Example #11
0
}
?>
</table>


<table class="contentTable" style="width: 100%">
<tr>
  <td>
<div class="itemInfo discussionInfo">
  <div class="itemInfoContainer">  
    <div class="itemDescription"><?php 
echo replaceTextToLinks($discussions->getDescription());
?>
</div>
    <div id="extraFieldsInDescription"><?php 
echo ExtraFieldsList::renderDescriptionFileds('discussions', $discussions, $sf_user);
?>
</div>
    <div><?php 
include_component('attachments', 'attachmentsList', array('bind_type' => 'discussions', 'bind_id' => $discussions->getId()));
?>
</div>
  </div>
</div>     
<br>
<?php 
echo input_hidden_tag('item_name', $discussions->getName()) . input_hidden_tag('item_description', $discussions->getDescription());
$comments_access = Users::getAccessSchema('discussionsComments', $sf_user, $projects->getId());
if ($comments_access['view']) {
    $lc = new cfgListingController($sf_context->getModuleName(), 'projects_id=' . $sf_request->getParameter('projects_id') . '&discussions_id=' . $discussions->getId());
    ?>
Example #12
0
</td>
  </tr>
  
  <?php 
if ($projects->getProjectsStatusId() > 0) {
    echo '<tr><th>' . __('Status') . ':</th><td>' . $projects->getProjectsStatus()->getName() . '</td></tr>';
}
?>
  <?php 
if ($projects->getProjectsTypesId() > 0) {
    echo '<tr><th>' . __('Type') . ':</th><td>' . $projects->getProjectsTypes()->getName() . '</td></tr>';
}
?>
    
  <?php 
echo ExtraFieldsList::renderInfoFileds('projects', $projects, $sf_user);
?>
  
  <tr><td style="padding-top: 7px;"></td></tr>
  
  <tr>
    <th><?php 
echo __('Created At');
?>
:</th>
    <td><?php 
echo app::dateTimeFormat($projects->getCreatedAt());
?>
</td>
  </tr>  
  <tr>
Example #13
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;
     }
 }
Example #14
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'));
     }
 }
Example #15
0
</th>
              <td>
                <?php 
echo $form['description']->renderError();
?>
                <?php 
echo $form['description'];
?>
              </td>
            </tr>
            
            <?php 
echo ExtraFieldsList::renderFormFiledsByType('tasks', $form->getObject(), $sf_user, 'text');
?>
            <?php 
echo ExtraFieldsList::renderFormFiledsByType('tasks', $form->getObject(), $sf_user, 'file');
?>
            
            
            <?php 
if (Users::hasAccess('edit', 'projects', $sf_user, $sf_request->getParameter('projects_id'))) {
    ?>
            <tr>
              <th><?php 
    echo $form['created_by']->renderLabel();
    ?>
</th>
              <td>
                <?php 
    echo $form['created_by']->renderError();
    ?>
Example #16
0
  </tr>
  
  <?php 
if ($tickets->getTicketsStatusId() > 0) {
    echo '<tr><th>' . __('Status') . ':</th><td>' . $tickets->getTicketsStatus()->getName() . '</td></tr>';
}
?>
    
  <?php 
if ($tickets->getTicketsTypesId() > 0) {
    echo '<tr><th>' . __('Type') . ':</th><td>' . $tickets->getTicketsTypes()->getName() . '</td></tr>';
}
?>
      
  <?php 
echo ExtraFieldsList::renderInfoFileds('tickets', $tickets, $sf_user);
?>
    
  <tr><td style="padding-top: 7px;"></td></tr>
      
  <tr>
    <th><?php 
echo __('Created At');
?>
:</th>
    <td><?php 
echo app::dateTimeFormat($tickets->getCreatedAt());
?>
</td>
  </tr>   
</table>
Example #17
0
  <?php 
}
?>
</table>

<table class="contentTable" style="width: 100%">
<tr>
  <td>
<div class="itemInfo ticketInfo">
  <div class="itemInfoContainer">   
    <div class="itemDescription"><?php 
echo replaceTextToLinks($tickets->getDescription());
?>
</div>
    <div id="extraFieldsInDescription"><?php 
echo ExtraFieldsList::renderDescriptionFileds('tickets', $tickets, $sf_user);
?>
</div>
    <div><?php 
include_component('attachments', 'attachmentsList', array('bind_type' => 'tickets', 'bind_id' => $tickets->getId()));
?>
</div>
  </div>
</div>     
<br>
<?php 
echo input_hidden_tag('item_name', $tickets->getName()) . input_hidden_tag('item_description', $tickets->getDescription());
$comments_access = Users::getAccessSchema('ticketsComments', $sf_user, isset($projects) ? $projects->getId() : false);
if ($comments_access['view']) {
    $lc = new cfgListingController($sf_context->getModuleName(), 'tickets_id=' . $tickets->getId() . (isset($projects) ? '&projects_id=' . $projects->getId() : ''));
    ?>
Example #18
0
?>
:</th>
    <td><?php 
echo $discussions->getId();
?>
</td>
  </tr>
    
  <?php 
if ($discussions->getDiscussionsStatusId() > 0) {
    echo '<tr><th>' . __('Status') . ':</th><td>' . $discussions->getDiscussionsStatus()->getName() . '</td></tr>';
}
?>
      
  <?php 
echo ExtraFieldsList::renderInfoFileds('discussions', $discussions, $sf_user);
?>
      
  <tr><td style="padding-top: 7px;"></td></tr>       
</table>
<br>
<h2><?php 
echo __('Assigned To');
?>
</h2>
<table class="contentTable" style="margin-bottom: 7px;">
<?php 
foreach (explode(',', $discussions->getAssignedTo()) as $users_id) {
    if ($user = Doctrine_Core::getTable('Users')->find($users_id)) {
        echo '<tr><th><div style="float:left;">' . renderUserPhoto($user->getPhoto()) . '</div>&nbsp;' . $user->getName() . '<br>' . '</td></tr>';
    }
Example #19
0
                <th><?php 
echo $form['event_name']->renderLabel();
?>
</th>
                <td>
                  <?php 
echo $form['event_name']->renderError();
?>
                  <?php 
echo $form['event_name'];
?>
                </td>
              </tr>
              
              <?php 
echo ExtraFieldsList::renderFormFileds('events', $form->getObject(), $sf_user);
?>
              
              <tr>
                <th><?php 
echo $form['start_date']->renderLabel();
?>
</th>
                <td>
                  <?php 
echo $form['start_date']->renderError();
?>
                  <?php 
echo $form['start_date'];
?>
                </td>
Example #20
0
<?php

include_component('projects', 'shortInfo', array('projects' => $projects));
?>

<table class="contentTable" style="width: 100%">
<tr>
  <td>
    <div class="itemInfo projectInfo">
      <div class="itemInfoContainer">
        <div class="itemDescription"><?php 
echo replaceTextToLinks($projects->getDescription());
?>
</div>
        <div id="extraFieldsInDescription"><?php 
echo ExtraFieldsList::renderDescriptionFileds('projects', $projects, $sf_user);
?>
</div>
        <div><?php 
include_component('attachments', 'attachmentsList', array('bind_type' => 'projects', 'bind_id' => $projects->getId()));
?>
</div>
      </div>
    </div>
<br>
<?php 
$comments_access = Users::getAccessSchema('projectsComments', $sf_user, $projects->getId());
if ($comments_access['view']) {
    $lc = new cfgListingController($sf_context->getModuleName(), 'projects_id=' . $sf_request->getParameter('projects_id'));
    ?>
Example #21
0
      <?php 
    if ($lc->access['edit'] or $lc->access['delete']) {
        echo '<td></td>';
    }
    ?>
      <?php 
    foreach ($in_listing as $v) {
        if (in_array($v, array('EstimatedTime', 'WorkHours'))) {
            echo '<td>' . $totals[$v] . '</td>';
        } else {
            echo '<td></td>';
        }
    }
    ?>
      <?php 
    echo ExtraFieldsList::renderListingTotals($totals, $extra_fields);
    ?>
      <?php 
    if (!$sf_request->hasParameter('projects_id')) {
        echo '<td></td>';
    }
    ?>
    </tr>  
    </tfoot>
    <?php 
}
?>
    
    <?php 
if (sizeof($tasks_list) == 0) {
    echo '<tr><td colspan="30">' . __('No Records Found') . '</td></tr>';
Example #22
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $events = $form->save();
         ExtraFieldsList::setValues($request->getParameter('extra_fields'), $events->getEventId(), 'events', $this->getUser());
         Attachments::insertAttachments($request->getFiles(), 'events', $events->getEventId(), $request->getParameter('attachments_info'), $this->getUser());
         if ($events->getUsersId() > 0) {
             $this->redirect('scheduler/personal');
         } else {
             $this->redirect('scheduler/index');
         }
     }
 }