Example #1
0
 public function executeNewFolder(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $folder = new Folder();
     $folder->setName('New ' . InterfaceLabelTable::getInstance()->get($this->getuser()->getGuardUser(), InterfaceLabelTable::FOLDER_TYPE));
     $folder->setUser($this->getUser()->getGuardUser());
     $folder->setType(Folder::TYPE_ROADMAP);
     if (!Folder::getInstance()->getNotDeletableForUser($this->getUser()->getGuardUser(), Folder::TYPE_ROADMAP, false)) {
         $folder->setDeletable(false);
     }
     $folder->save();
     // Create log
     $log = new Log();
     $log->injectDataAndPersist($folder, $this->getUser()->getGuardUser(), array('action' => 'new'));
     return $this->renderText(json_encode($folder->getRowData()));
 }
Example #2
0
 public function executeEditLabel(sfWebRequest $request)
 {
     $pk = explode('_', $request->getParameter('pk'));
     if (in_array($pk[0], array(1, 2, 3, 4)) && in_array($pk[1], array('singular', 'plural')) && $request->hasParameter('value')) {
         $exist = InterfaceLabelTable::getInstance()->createQuery('il')->where('il.type = ?', $pk[0])->andWhere('il.user_id = ?', $this->getUser()->getGuardUser()->getId())->count();
         if ($exist) {
             InterfaceLabelTable::getInstance()->createQuery('il')->update()->set($pk[1], '?', $request->getParameter('value'))->where('il.type = ?', $pk[0])->andWhere('il.user_id = ?', $this->getUser()->getGuardUser()->getId())->execute();
         } else {
             $interface_label = new InterfaceLabel();
             $interface_label->type = $pk[0];
             $interface_label->user_id = $this->getUser()->getGuardUser()->getId();
             $interface_label->{$pk[1]} = $request->getParameter('value');
             $interface_label->save();
         }
     }
     return sfView::NONE;
 }
Example #3
0
        <?php 
    }
    ?>
      </div>
    </div>
  </div>
<?php 
}
?>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseSixOne">
          <?php 
echo $decision->relatedExists('Type') && $decision->type_id == 2 ? "<p class='label_capitalize'>" . InterfaceLabelTable::getInstance()->get($sf_data->getRaw('sf_user')->getGuardUser(), InterfaceLabelTable::RELEASE_TYPE) . "</p> planner" : 'Partition allocation';
?>
        </a>
      </h4>
    </div>
    <div id="collapseSixOne" data-section="partition_allocation" class="panel-collapse collapse<?php 
echo $analyzeCollapse->partition_allocation ? '' : ' in';
?>
">
      <div class="panel-body">
        <?php 
include_partial('partition_allocation', array('releases' => $releases, 'decision' => $decision, 'alternatives_json' => $alternatives_json));
?>
      </div>
    </div>
  </div>
Example #4
0
        $icon.attr('class','fa fa-minus-square-o')
      } else  {
        $icon.attr('class','fa fa-plus-square-o')
      }

    });
    $('#decision_type_id :nth-child(2)').prop('selected', true);

    $("#next_1").click(function() {
      $("#step_1").hide();

      $firstStepError.text('').hide();

      if ($.trim($projectName.val()) == '') {
        $projectName.val('New <?php 
echo InterfaceLabelTable::getInstance()->get($sf_data->getRaw('sf_user')->getGuardUser(), InterfaceLabelTable::PROJECT_TYPE);
?>
')
      }

      $.ajax({
        type      : "POST",
        url       : '<?php 
echo url_for('wizard/decisionModalSave');
?>
',
        dataType  : 'json',
        data      : {
          "name"       : $projectName.val(),
          "type_id"    : $("#decision_type_id").val(),
          "template_id": $("#decision_template_id").val()
Example #5
0
  $bulk_actions.on('change', function () {
    this.value == 'move_to' || this.value == 'copy_to' ? $move_to.show() : $move_to.hide();
  });

  $('#apply-bulk-action').on('click', function () {
    var ids = [];

    $('.check:checked').each(function () {
      ids.push(this.value);
    });

    if (ids.length){
      if ($bulk_actions.val() == 'delete') {
        if (confirm('Do you want to permanently delete these <?php 
echo InterfaceLabelTable::getInstance()->get($sf_data->getRaw('sf_user')->getGuardUser(), InterfaceLabelTable::ITEM_TYPE, true);
?>
?')) {
          $.post('<?php 
echo url_for('@alternative\\bulkDelete');
?>
', { ids: ids }, function() { window.location.reload(); } );
        }
      } else if ($bulk_actions.val() == 'move_to') {
        $.post('<?php 
echo url_for('@alternative\\bulkMove');
?>
', { ids: ids, decision_id: $move_to.val() }, function() { window.location.reload(); } );
      } else if ($bulk_actions.val() == 'copy_to') {
        $.post('<?php 
echo url_for('@alternative\\bulkCopy');
Example #6
0
      "iLeftColumns": 1,
      "iLeftWidth": 250
    } );

    $('.dataTables_scrollFootInner > table').add('.DTFC_LeftFootWrapper > table').removeClass('table-bordered');

    $('.table-view-search > .btn').click(function(){
      oTable
        .search( $('.table-view-search > input').val() )
        .draw();
    });

    // Delete response
    $('a[id^=delete-response]').on('click', function () {
      if (confirm('<?php 
echo 'You are about to delete this ' . InterfaceLabelTable::getInstance()->get($sf_data->getRaw('sf_user')->getGuardUser(), InterfaceLabelTable::ITEM_TYPE) . '. Press Ok to continue.';
?>
')) {
        oTable
            .rows(parseInt($(this).closest('tr').index(), 10))
            .remove()
            .draw()
        ;
        $.post('<?php 
echo url_for('@response\\delete');
?>
', { id: $(this).attr('id').replace('delete-response-', ''), 'sf_method':'delete' });
      }
    });
  });
</script>
Example #7
0
 /**
  * @return int|string
  */
 private function getQuickStats()
 {
     $quick_stats = count($this->getAlternative()) . ' ' . InterfaceLabelTable::getInstance()->get(sfContext::getInstance()->getUser()->getGuardUser(), InterfaceLabelTable::ITEM_TYPE, count($this->getAlternative()) > 1) . ' with ' . count($this->getRoles()) . ' ';
     if (count($this->getRoles()) > 1) {
         $quick_stats .= 'criteria';
     } else {
         $quick_stats .= 'criterion';
     }
     $quick_stats .= ' has ' . count($this->getRoles()) . ' survey';
     if (count($this->getRoles()) > 1) {
         $quick_stats .= 's';
     }
     $quick_stats .= ' with ' . count($this->getResponse()) . ' answer';
     if (count($this->getResponse()) > 1) {
         $quick_stats .= 's';
     }
     return $quick_stats;
 }
Example #8
0
<div class="btn-toolbar pull-right">
  <div class="btn-group">
    <button data-toggle="dropdown" class="btn btn-success btn-lg dropdown-toggle"><?php 
echo $sf_user->getGuardUser();
?>
 <span class="caret"></span></button>
    <ul class="dropdown-menu">
      <li><?php 
echo link_to('Administration', '/administration');
?>
</li>
      <li><?php 
echo link_to('My ' . InterfaceLabelTable::getInstance()->get($sf_data->getRaw('sf_user')->getGuardUser(), InterfaceLabelTable::PROJECT_TYPE, false), '/project');
?>
</li>
      <?php 
if ($sf_user->hasRoadmapAccess()) {
    ?>
        <li><?php 
    echo link_to('My roadmaps', '/roadmap');
    ?>
</li>
      <?php 
}
?>
      <li><?php 
echo link_to('My account', '/project/user/account');
?>
</li>
      <li class="divider"></li>
      <li><a href="<?php 
Example #9
0
<td>
  <?php 
if ($form->getObject()->deletable) {
    ?>
    <a href="javascript:void(0)" class="delete glyphicon glyphicon-remove-circle btn btn-danger btn-small"></a>
  <?php 
}
?>
  <span id="edit-url" data-url="<?php 
echo url_for('@roadmap\\editFolder?id=' . $form->getObject()->id);
?>
"></span>
  <script>
    $(function () {
      var default_text = '<?php 
echo 'New ' . InterfaceLabelTable::getInstance()->get($sf_data->getRaw('sf_user')->getGuardUser(), InterfaceLabelTable::FOLDER_TYPE);
?>
';

      $('#folder_name').on('change', function () {
        if (!$(this).val()) {
          $(this).val(default_text);
        }
      }).on('focus', function () {
        if ($(this).val() == default_text) {
          $(this).val('');
        }
      });

      $(".autosave").autosave({
        url     : "<?php 
Example #10
0
 /**
  * @param sfWebRequest $request
  * @return sfView
  */
 public function executeImportFromCustomFields(sfWebRequest $request)
 {
     $decision_id = $request->getParameter('decision_id', false);
     $decision = DecisionTable::getInstance()->getDecisionForUser($this->getUser()->getGuardUser(), $decision_id);
     $this->forward404Unless(is_object($decision));
     $header = $request->getParameter('header');
     $data = $request->getParameter('data');
     if (array_search('name', $header) === false) {
         return $this->renderText(json_encode(array('status' => 'error', 'text' => 'Please ensure that data field "Name" is mapped to a column in your SpreadSheet.')));
     }
     foreach ($data as $item) {
         $alternative = null;
         if (array_key_exists('id', $item) && !empty($item['id'])) {
             $alternative = AlternativeTable::getInstance()->createQuery('a')->leftJoin('a.Decision d')->leftJoin('d.User u')->leftJoin('u.TeamMember tm')->whereIn('d.user_id', sfGuardUserTable::getInstance()->getUsersInTeamIDs($this->getUser()->getGuardUser()))->andWhere('a.item_id = ?', $item['id'])->andWhere('d.id = ?', $decision->getId())->fetchOne();
         }
         if (!is_object($alternative)) {
             $alternative = new Alternative();
             $alternative->setDecision($decision);
             $alternative->setCreatedBy(Alternative::generateUpdateAndCreatedBy($this->getUser()->getGuardUser()));
             $alternative->setUpdatedBy(Alternative::generateUpdateAndCreatedBy($this->getUser()->getGuardUser()));
         }
         $custom_fields = array();
         foreach ($item as $prop => $value) {
             if (array_key_exists($prop, $header)) {
                 if ($header[$prop] == '_new') {
                     $custom_fields[$prop] = $value;
                 } elseif (!in_array($header[$prop], array('id')) && in_array($header[$prop], array('name', 'status', 'work progress', 'additional info', 'notes', 'due date', 'notify date', 'tags'))) {
                     if ($header[$prop] == 'tags') {
                         // Process tags
                         $tags_request = array_map('trim', explode(',', $value));
                         $tags = array();
                         foreach ($alternative->getTagAlternative() as $tag) {
                             $tags[] = $tag->Tag->name;
                         }
                         foreach (array_diff($tags_request, $tags) as $result) {
                             Tag::newTag($this->getUser()->getGuardUser(), $alternative->getId(), $result, 'alternative');
                         }
                         foreach (array_diff($tags, $tags_request) as $result) {
                             Tag::removeTag($this->getUser()->getGuardUser(), $alternative->getId(), $result, 'alternative');
                         }
                     } else {
                         $alternative->{str_replace(' ', '_', $header[$prop])} = $value;
                     }
                 }
             }
         }
         if ($custom_fields) {
             $alternative->setCustomFields(json_encode($custom_fields));
         }
         if (!$alternative->getName()) {
             $alternative->setName('New ' . InterfaceLabelTable::getInstance()->get($this->getUser()->getGuardUser(), InterfaceLabelTable::ITEM_TYPE));
         }
         $alternative->save();
     }
     return $this->renderText(json_encode(array('status' => 'success')));
 }
Example #11
0
?>
      <span class="caret"></span></a>
    <ul class="dropdown-menu">
      <?php 
if ($sf_user->hasCredential('admin')) {
    ?>
        <li><?php 
    echo link_to('<i class="glyphicon glyphicon-cog"></i> Administration', '/administration');
    ?>
</li>
        <li class="divider"></li>
      <?php 
}
?>
      <li><?php 
echo link_to('<i class="glyphicon glyphicon-th-list"></i> My ' . InterfaceLabelTable::getInstance()->get($sf_data->getRaw('sf_user')->getGuardUser(), InterfaceLabelTable::PROJECT_TYPE, true), '@decision');
?>
</li>
      <?php 
if ($sf_user->hasRoadmapAccess()) {
    ?>
        <li><?php 
    echo link_to('<i class="glyphicon glyphicon-road"></i> My roadmaps', '@roadmap');
    ?>
</li>
      <?php 
}
?>
      <li><?php 
echo link_to('<i class="glyphicon glyphicon-user"></i> My account', '@user_profile');
?>