Example #1
0
 /**
  * Method for rendering table
  * @return array - AJAX Response
  */
 public function __async_table()
 {
     // Create query to get users
     $query = dbQuery('user')->Active(1)->order_by('UserID');
     // Create generic table for users
     $table = new Table($query);
     return array('status' => 1, 'table' => $table->render());
 }
Example #2
0
 public static function renderTable($nav = 0, $page = 0, &$pager = null)
 {
     // Set new pager
     $pager = new \samson\pager\Pager($page, 5, 'field/updatetable/' . $nav . '/');
     // Create SamsonCMS fields table
     $table = new Table($pager, $nav);
     // Render view
     return m()->view('index')->title('Дополнительные поля')->set('table', $table->render(null, $nav))->set($pager)->output();
 }
 protected function base_list_sql($entity_name, $cols, $sql)
 {
     if (empty($cols)) {
         throw new Exception('Base list error - Undefined columns for table');
     }
     $class = ucfirst($entity_name);
     if (!class_exists($class)) {
         throw new Exception('Base list error - Undefined class ' . $class);
     }
     $list = $class::getList($sql);
     $table = new Table('data-table', $entity_name, $list, $cols, ROOT_HTTP . 'admin/' . $entity_name . '/update', ROOT_HTTP . 'admin/' . $entity_name . '/delete');
     $vars = array('list' => $list, 'table' => $table->render());
     $this->render('admin/' . $entity_name, $vars);
 }
Example #4
0
 /**
  * Executa comando
  *
  * @param Object $oInput
  * @param Object $oOutput
  * @access public
  * @return void
  */
 public function execute($oInput, $oOutput)
 {
     $oParametros = new \StdClass();
     $oParametros->aArquivos = $oInput->getArgument('arquivos');
     $oParametros->iTag = ltrim(strtoupper($oInput->getOption('tag')), 'T');
     $oParametros->aMensagens = $oInput->getOption('message');
     $oParametros->sData = $oInput->getOption('date');
     $oArquivoModel = new ArquivoModel();
     $aArquivosCommitados = $oArquivoModel->getCommitados($oParametros);
     if (empty($aArquivosCommitados)) {
         throw new \Exception("Nenhum arquivo encontrado.");
     }
     $oOutput->writeln("");
     $oBuscaOutputFormatter = new OutputFormatterStyle('red', null, array());
     $oOutput->getFormatter()->setStyle('busca', $oBuscaOutputFormatter);
     foreach ($aArquivosCommitados as $oDadosCommit) {
         $sTitulo = "- <comment>" . date('d/m/Y', strtotime($oDadosCommit->date)) . "</comment> as " . date('H:s:i', strtotime($oDadosCommit->date));
         $sTitulo .= " " . count($oDadosCommit->aArquivos) . " arquivo(s) commitado(s)";
         $oOutput->writeln($sTitulo);
         if (!empty($oDadosCommit->title)) {
             $oOutput->writeln("\n  " . $oDadosCommit->title);
         }
         $oTabela = new \Table();
         $oTabela->setHeaders(array('1', '1', '1', '1'));
         foreach ($oDadosCommit->aArquivos as $oArquivo) {
             $sArquivo = $this->getApplication()->clearPath($oArquivo->name);
             $sTag = $oArquivo->tag;
             $sMensagem = $oArquivo->message;
             foreach ($oParametros->aArquivos as $sParametroArquivo) {
                 $sArquivo = $this->colorirBusca($sArquivo, $sParametroArquivo, 'busca');
             }
             if (!empty($oParametros->iTag)) {
                 $sTag = $this->colorirBusca($oArquivo->tag, $oParametros->iTag, 'busca');
             }
             if (!empty($oParametros->aMensagens)) {
                 foreach ($oParametros->aMensagens as $sMensagemBuscar) {
                     $sMensagem = $this->colorirBusca($sMensagem, $sMensagemBuscar, 'busca');
                 }
             }
             $oTabela->addRow(array($oArquivo->type, " {$sArquivo}", " {$sTag}", " {$sMensagem}"));
         }
         $oOutput->writeln("  " . str_replace("\n", "\n  ", $oTabela->render(true)));
     }
 }
Example #5
0
 /**
  * Default controller action. This is the default action which is executed
  * when no action is specified for a given call.
  * @see lib/controllers/Controller::getContents()
  */
 public function getContents()
 {
     if (count($this->listFields) > 0) {
         $fieldNames = $this->listFields;
     } else {
         if ($this->app != null) {
             $fieldNames = $this->app->xpath("/app:app/app:list/app:field");
             $concatenatedLabels = $this->app->xpath("/app:app/app:list/app:field/@label");
         } else {
             $fieldNames = array();
             $keyField = $this->model->getKeyField();
             $fieldNames[$keyField] = "{$this->model->package}.{$keyField}";
             $fields = $this->model->getFields();
             foreach ($fields as $i => $field) {
                 if ($field["reference"] == "") {
                     $fieldNames[$i] = $this->model->package . "." . $field["name"];
                 } else {
                     $modelInfo = Model::resolvePath($field["reference"]);
                     $fieldNames[$i] = $modelInfo["model"] . "." . $field["referenceValue"];
                 }
             }
         }
     }
     foreach ($fieldNames as $i => $fieldName) {
         $fieldNames[$i] = substr((string) $fieldName, 0, 1) == "." ? $this->redirectedPackage . (string) $fieldName : (string) $fieldName;
     }
     if (count($this->fieldNames) > 0) {
         $fieldNames = $this->fieldNames;
     }
     if ($this->apiMode === false) {
         $this->setupList();
         $params["fields"] = $fieldNames;
         $params["page"] = 0;
         $params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC"));
         $this->table->setParams($params);
         $return = '<div id="table-wrapper">' . $this->toolbar->render() . $this->table->render() . '</div>';
     } else {
         $params["fields"] = $fieldNames;
         $params["page"] = 0;
         $params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC"));
         $return = json_encode(SQLDBDataStore::getMulti($params));
     }
     return $return;
 }
Example #6
0
 /**
  * Render process
  *
  * @return string
  */
 public function process($items, $pager)
 {
     $table = new Table(array('name' => $this->name, 'class' => 'table table-bordered table-striped shd', 'fields' => $this->getFields()));
     $table->object($items);
     return $table->render() . $pager->render();
 }
Example #7
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return mixed
  * @since 1.1.9
  */
 public function render($ajax_render = false)
 {
     $gallery_table = new Table();
     $gallery_table->setId("PhotoGalleryTable" . rand(0, 999999))->activatePagination();
     $header = new RowTable();
     for ($i = 0; $i < $this->nb_col; $i++) {
         $header->add();
     }
     $gallery_table->addRow($header->setHeaderClass(0));
     $ind = 0;
     $last_ind = -1;
     $gallery_row = null;
     $files = scandir($this->path, 1);
     for ($i = 0; $i < sizeof($files); $i++) {
         $file = $files[$i];
         if ($file != "." && $file != "..") {
             $getExt = explode(".", $file);
             $countExt = count($getExt);
             $fExt = $countExt - 1;
             $myExt = $getExt[$fExt];
             if ((is_dir($this->path . $file) || $this->in_arrayi($myExt, $this->picture_ext)) && $file != $this->thumbnail_folder) {
                 if ($ind != $last_ind && $ind % $this->nb_col == 0) {
                     if ($gallery_row != null) {
                         $gallery_table->addRow($gallery_row);
                     }
                     $gallery_row = new RowTable();
                     $gallery_row->setWidth("25%");
                     $last_ind = $ind;
                 }
                 if (is_dir($this->path . $file)) {
                     if ($this->subfolder) {
                         $folder_pic = new Picture($this->folder_pic, 128, 128, 0, Picture::ALIGN_ABSMIDDLE, $file);
                         $url = $this->getPage()->getCurrentURL();
                         if (($pos = find($url, "gallery_event=")) > 0) {
                             $pos2 = find($url, "&", 0, $pos);
                             if ($pos2 == 0) {
                                 $url = substr($url, 0, $pos - 1);
                             } else {
                                 $url1 = substr($url, 0, $pos - 1);
                                 $url2 = substr($url, $pos2, strlen($url));
                                 $url = $url1 . $url2;
                             }
                         }
                         if (find($url, "?") > 0) {
                             $url = $url . "&";
                         } else {
                             $url = $url . "?";
                         }
                         $url = $url . "gallery_event=" . urlencode(str_replace($this->original_path, "", $this->path . $file));
                         $folder_link = new Link($url, Link::TARGET_NONE, new Object($folder_pic, "<br/>", $file));
                         $gallery_row->add($folder_link);
                         $ind++;
                     }
                 } else {
                     if ($this->in_arrayi($myExt, $this->picture_ext)) {
                         $pic_file = str_replace(str_replace("\\", "/", realpath(SITE_DIRECTORY)) . "/", "", str_replace("\\", "/", realpath($this->path)) . "/" . $file);
                         $pic_file_lower_ext = str_replace("." . $myExt, strtolower("." . $myExt), $pic_file);
                         if ($pic_file_lower_ext != $pic_file) {
                             $path_file_lower_ext = str_replace($pic_file, $pic_file_lower_ext, str_replace("\\", "/", realpath(SITE_DIRECTORY . "/" . $pic_file)));
                             if (!rename(realpath(SITE_DIRECTORY . "/" . $pic_file), $path_file_lower_ext)) {
                                 $pic_file_lower_ext = $pic_file;
                             }
                         }
                         $pic_name = str_replace("." . $myExt, "", $file);
                         $pic_thumbnail = $pic_file_lower_ext;
                         if (trim($this->thumbnail_folder) != "") {
                             if (in_array(strtolower($myExt), array("jpg", "jpeg", "gif", "png"))) {
                                 if (!is_dir(realpath($this->path) . "/" . $this->thumbnail_folder)) {
                                     mkdir(realpath($this->path) . "/" . $this->thumbnail_folder);
                                 }
                                 $pic_thumbnail_path = realpath($this->path . "/" . $this->thumbnail_folder) . "/" . str_replace("." . $myExt, strtolower("." . $myExt), $file);
                                 $pic_thumbnail = str_replace(str_replace("\\", "/", realpath(SITE_DIRECTORY)) . "/", "", str_replace("\\", "/", realpath($this->path . "/" . $this->thumbnail_folder)) . "/" . str_replace("." . $myExt, strtolower("." . $myExt), $file));
                                 if (strtolower($myExt) == "gif") {
                                     // convert to jpg
                                     $pic_thumbnail_path = str_replace(".gif", ".jpg", $pic_thumbnail_path);
                                     $pic_thumbnail = str_replace(".gif", ".jpg", $pic_thumbnail);
                                 }
                                 if (!file_exists($pic_thumbnail_path)) {
                                     if (strtolower($myExt) == "jpg" || strtolower($myExt) == "jpeg") {
                                         jpegReductionFixe($pic_file_lower_ext, $pic_thumbnail_path, 128, 128);
                                     } else {
                                         if (strtolower($myExt) == "png") {
                                             pngReductionFixe($pic_file_lower_ext, $pic_thumbnail_path, 128, 128);
                                         } else {
                                             $tmp_file = realpath($this->path . "/" . $this->thumbnail_folder) . "/temp.jpg";
                                             gif2jpeg($pic_file_lower_ext, $tmp_file);
                                             jpegReductionFixe($tmp_file, $pic_thumbnail_path, 128, 128);
                                             unlink($tmp_file);
                                         }
                                     }
                                 }
                             }
                         }
                         $pic = new Picture($pic_thumbnail, 128, 128, 0, Picture::ALIGN_ABSMIDDLE, $pic_name);
                         $pic->addLightbox("Lightbox" . $gallery_table->getId(), $pic_file_lower_ext, "\$(window).width()-(\$(window).width()*0.2)", "\$(window).height()-(\$(window).height()*0.2)");
                         $gallery_row->add(new Object($pic, "<br/>", $pic_name));
                         $ind++;
                     }
                 }
             }
         }
     }
     if ($gallery_row != null) {
         while ($ind % $this->nb_col != 0) {
             $gallery_row->add();
             $ind++;
         }
         $gallery_table->addRow($gallery_row);
     }
     return $gallery_table->render($ajax_render);
 }
Example #8
0
    public function testRenderTableLargerThanScreenEstate()
    {
        $rows = [['TY', 'KT Rolster', 'Terran'], ['Maru', 'Jin Air Green Wings', 'Terran']];
        $headers = ['Player', 'Team', 'Race'];
        $table = new Table($rows, ['headers' => $headers]);
        $table->render(['screenEstate' => ['x' => 13]]);
        $expected = <<<EXPECTED
Player | Te ▶
-------+--- ▶
TY     | KT ▶
Maru   | Ji ▶

EXPECTED;
        $this->assertEquals(str_split($expected), str_split($this->getActualOutput()));
        $this->expectOutputString($expected);
    }
 public function student()
 {
     function isEmpty($value)
     {
         return strlen('' . $value) == 0;
     }
     //if ($this->user->firstname == 'fred'){
     //echo 'user->school_id &#9830; '.$this->user->school_id.'<br>';
     //echo (int)empty($this->request->get('school')).'<br>';
     //echo $this->request->get('school', 0).'<br>';
     //echo 'empty(user->school_id) &#9830; '.(int)isEmpty($this->user->school_id).'<br>';
     //}
     $school_id = !isEmpty($this->user->school_id) ? $this->user->school_id : 1;
     //if ($this->user->firstname == 'fred') echo '$school_id &#9830; '.$school_id.'<br>';
     $school_id = !empty($this->request->get('school')) ? $this->request->get('school') : $school_id;
     //if ($this->user->firstname == 'fred') echo '$school_id &#9830; '.$school_id.'<br>';
     $schools = '';
     if ($this->user->isRole('admin') or $this->user->isRole('pdt')) {
         $schools = School::getList('SELECT * FROM school ORDER BY name DESC');
     }
     $where = '';
     $where = 'AND school_id=' . $school_id;
     if ($this->user->isRole('admin')) {
         $where = 'AND school_id=' . $school_id;
     }
     if ($this->user->isRole('pdt')) {
         $where = 'AND school_id=' . $school_id;
     }
     if ($this->user->isRole('dir')) {
         //$school_id = $this->user->school_id;
         $where = 'AND school_id=' . $school_id;
     }
     if ($this->user->isRole('prof')) {
         $where = 'AND school_id=' . $school_id;
     }
     $promos = Promotion::getList('SELECT * FROM session WHERE true ' . $where . ' ORDER BY date_start DESC');
     function currentPromo_id($promos)
     {
         $now = date('Y-m-d');
         foreach ($promos as $index => $promo) {
             if ($now >= $promo->date_start and $now <= $promo->date_end) {
                 return $promo->id;
             }
         }
         if (!empty($promo[0])) {
             return $promo[0]->id;
         } else {
             return '0';
         }
     }
     $promo_id = $this->request->get('promo', 0);
     if ($promo_id == 0) {
         $promo_id = currentPromo_id($promos);
     }
     $students = Student::getList('SELECT s.*, CONCAT(s.firstname," ",s.lastname)as fullname FROM student as s, session as p WHERE p.id=s.session_id AND p.id=' . $promo_id);
     $edit_url = $this->user->canDo('student_update') ? ROOT_HTTP . 'admin/student/update' : '';
     $delete_url = $this->user->canDo('student_delete') ? ROOT_HTTP . 'admin/student/delete' : '';
     $tableStudents = new Table('data-table', 'student', $students, ['id', 'fullname', 'email'], $edit_url, $delete_url);
     //if ($this->user->firstname == 'fred') echo '$school_id &#9830; '.$school_id.'<br>';
     $vars = ['canAddStudent' => $this->user->canDo('student_create'), 'schools' => $schools, 'school_id' => $school_id, 'promos' => $promos, 'promo_id' => $promo_id, 'table' => $tableStudents->render()];
     $this->render('admin/student', $vars);
 }
Example #10
0
 /**
  * Executa comando
  *
  * @param Object $oInput
  * @param Object $oOutput
  * @access public
  * @return void
  */
 public function execute($oInput, $oOutput)
 {
     $lTabela = false;
     $lCriados = false;
     $lModificados = false;
     $lConflitos = false;
     $lAtulizados = false;
     $lAdicionados = false;
     $lRemovidos = false;
     $lPush = false;
     $lPesquisaCvs = true;
     $aArquivosParaCommit = array();
     $aTabelaModificacoes = array();
     $aModificacoes = array();
     $aRetornoComandoUpdate = array();
     $aModificados = array();
     $aCriados = array();
     $aAtualizados = array();
     $aConflitos = array();
     $aAdicionados = array();
     $aRemovidos = array();
     $aRemovidosLocal = array();
     $sStatusOutput = "";
     $sStatusOutputTabela = "";
     $sListaUpdate = "";
     $sListaArquivos = "";
     $iParametros = 0;
     foreach ($oInput->getOptions() as $sArgumento => $sValorArgumento) {
         if (empty($sValorArgumento)) {
             continue;
         }
         switch ($sArgumento) {
             /**
              * Exibe modificacoes em tabela
              */
             case 'table':
                 $lTabela = true;
                 $iParametros++;
                 break;
                 /**
                  * Criados
                  */
             /**
              * Criados
              */
             case 'new':
                 $lCriados = true;
                 $iParametros++;
                 break;
                 /**
                  * Modificados
                  */
             /**
              * Modificados
              */
             case 'modified':
                 $lModificados = true;
                 $iParametros++;
                 break;
                 /**
                  * Conflitos
                  */
             /**
              * Conflitos
              */
             case 'conflict':
                 $lConflitos = true;
                 $iParametros++;
                 break;
             case 'update':
                 $lAtulizados = true;
                 $iParametros++;
                 break;
             case 'added':
                 $lAdicionados = true;
                 $iParametros++;
                 break;
             case 'removed':
                 $lRemovidos = true;
                 $iParametros++;
                 break;
             case 'push':
                 $lPush = true;
                 $iParametros++;
                 break;
         }
     }
     /**
      * Passou somente parametro --push
      * - Nao pesquisa cvs(commando cvs -qn update)
      */
     if ($iParametros == 1 && $lPush) {
         $lPesquisaCvs = false;
     }
     /**
      * Passou parametros --push e --table
      * - Nao pesquisa cvs(commando cvs -qn update)
      */
     if ($iParametros == 2 && $lPush && $lTabela) {
         $lPesquisaCvs = false;
     }
     /**
      * - Nenhum parametro informado
      * - Passou somente parametro --table
      */
     if ($iParametros == 0 || $lTabela && $iParametros == 1) {
         $lCriados = true;
         $lModificados = true;
         $lConflitos = true;
         $lAtulizados = true;
         $lAdicionados = true;
         $lRemovidos = true;
         $lPush = true;
     }
     /**
      * Model do comando
      */
     $oArquivoModel = new ArquivoModel();
     /**
      * lista dos arquivos adicionados para commit
      */
     $aArquivos = $oArquivoModel->getAdicionados();
     foreach ($aArquivos as $oCommit) {
         $aArquivosParaCommit[] = $this->getApplication()->clearPath($oCommit->getArquivo());
     }
     /**
      * Pesquisa modificacoes no cvs apenas se:
      *  - nenhum parametro informado
      *  - não passou somente parametro push
      */
     if ($lPesquisaCvs) {
         $oComando = $this->getApplication()->execute('cvs -qn update -dR');
         $aRetornoComandoUpdate = $oComando->output;
         $iStatusComandoUpdate = $oComando->code;
         /**
          * Verificação mair que 1 pois quando existem merge cvs retorna status 1
          * - e merge nao é erro, e sim aviso
          */
         if ($iStatusComandoUpdate > 1) {
             throw new Exception('Erro nº ' . $iStatusComandoUpdate . ' ao execurar cvs -qn update -dR:' . "\n" . $this->getApplication()->getLastError());
         }
     }
     /**
      * Arquivos para ignorar
      */
     $aArquivosIgnorar = array();
     $aIgnorar = $this->getApplication()->getConfig('ignore');
     foreach ($aIgnorar as $sIgnore) {
         $sOperador = "*";
         if (is_file($sIgnore)) {
             $sOperador = "";
         }
         $aFiles = $this->getApplication()->glob($sOperador, GLOB_BRACE, $sIgnore, true);
         $aArquivosIgnorar = array_merge($aArquivosIgnorar, $aFiles);
     }
     /**
      * Parse no retorno do comando cvs update
      */
     foreach ($aRetornoComandoUpdate as $sLinhaUpdate) {
         $aLinha = explode(' ', $sLinhaUpdate);
         $oLinha = new \StdClass();
         $sTipo = trim(array_shift($aLinha));
         /**
          * Linha não é um tipo de commit: U, ?, C...
          */
         if (!in_array($sTipo, array_keys($this->aTiposCommit))) {
             continue;
         }
         $oLinha->sTipo = $sTipo;
         $oLinha->sArquivo = trim(implode(' ', $aLinha));
         /**
          * Arquivo está na lista dos ignorados, pula
          */
         if (!empty($aIgnorar) && in_array($oLinha->sArquivo, $aArquivosIgnorar)) {
             continue;
         }
         /**
          * Array com todas as modificaos
          */
         $aModificacoes[$sTipo][] = $oLinha;
         /**
          * Lista com os erros do comando update
          */
         $aLinhasErros = explode("\n", $this->getApplication()->getLastError());
         /**
          * Arquivo removido localmente
          * Percorre as linhas de erro procurando o arquivo
          *
          * @todo - arquivo com ultima versao no cvs como removido nao aparece no update
          */
         foreach ($aLinhasErros as $sLinhaErro) {
             /**
              * Encontrou arquivo na linh atual
              */
             if (strpos($sLinhaErro, "`{$oLinha->sArquivo}'") !== false) {
                 /**
                  * Contei a string lost na linha atual do arquivo
                  */
                 if (strpos($sLinhaErro, "lost") !== false) {
                     $sTipo = "-";
                     break;
                 }
             }
         }
         /**
          * Separa em arrays as modificacoes pelo tipo de commit
          */
         switch ($sTipo) {
             /**
              * Novo
              */
             case '?':
                 $aCriados[] = $oLinha;
                 break;
                 /**
                  * Modificado
                  */
             /**
              * Modificado
              */
             case 'M':
                 $aModificados[] = $oLinha;
                 break;
                 /**
                  * Conflito
                  */
             /**
              * Conflito
              */
             case 'C':
                 $aConflitos[] = $oLinha;
                 break;
                 /**
                  * Atualizado
                  */
             /**
              * Atualizado
              */
             case 'U':
             case 'P':
                 $aAtualizados[] = $oLinha;
                 break;
                 /**
                  * Adicionado e nao commitado
                  */
             /**
              * Adicionado e nao commitado
              */
             case 'A':
                 $aAdicionados[] = $oLinha;
                 break;
                 /**
                  * Removido e nao commitado
                  */
             /**
              * Removido e nao commitado
              */
             case 'R':
                 $aRemovidos[] = $oLinha;
                 break;
                 /**
                  * Removido no projeto local
                  */
             /**
              * Removido no projeto local
              */
             case '-':
                 $aRemovidosLocal[] = $oLinha;
                 break;
         }
     }
     /**
      * Novos
      * - arquivos criados e nao adicionados para commit
      */
     if ($lCriados) {
         $sArquivosCriados = '';
         foreach ($aCriados as $oArquivoCriado) {
             if (in_array($oArquivoCriado->sArquivo, $aArquivosParaCommit)) {
                 continue;
             }
             $sArquivosCriados .= "\n " . $oArquivoCriado->sArquivo;
             $aTabelaModificacoes['?'][] = $oArquivoCriado->sArquivo;
         }
         if (!empty($sArquivosCriados)) {
             $sStatusOutput .= "\n- Arquivos criados: ";
             $sStatusOutput .= "\n <comment>{$sArquivosCriados}</comment>\n";
         }
     }
     /**
      * Modificados
      * - arquivos modificados e nao adicionados para commit
      */
     if ($lModificados) {
         $sArquivosModificados = '';
         foreach ($aModificados as $oArquivoModificado) {
             if (in_array($oArquivoModificado->sArquivo, $aArquivosParaCommit)) {
                 continue;
             }
             $sArquivosModificados .= "\n " . $oArquivoModificado->sArquivo;
             $aTabelaModificacoes['M'][] = $oArquivoModificado->sArquivo;
         }
         if (!empty($sArquivosModificados)) {
             $sStatusOutput .= "\n- Arquivos modificados: ";
             $sStatusOutput .= "\n <error>{$sArquivosModificados}</error>\n";
         }
     }
     /**
      * Conflitos
      * - arquivos com conflito
      */
     if ($lConflitos) {
         $sArquivosConflito = '';
         foreach ($aConflitos as $oArquivoConflito) {
             $sArquivosConflito .= "\n " . $oArquivoConflito->sArquivo;
             $aTabelaModificacoes['C'][] = $oArquivoConflito->sArquivo;
         }
         if (!empty($sArquivosConflito)) {
             $sStatusOutput .= "\n- Arquivos com conflito: ";
             $sStatusOutput .= "\n <error>{$sArquivosConflito}</error>\n";
         }
     }
     /**
      * Atualizados
      * - arquivos atualizados no repository e nao local
      */
     if ($lAtulizados) {
         $sArquivosAtualizados = '';
         foreach ($aAtualizados as $oArquivoAtualizado) {
             if (in_array($oArquivoAtualizado->sArquivo, $aArquivosParaCommit)) {
                 continue;
             }
             $sArquivosAtualizados .= "\n " . $oArquivoAtualizado->sArquivo;
             $aTabelaModificacoes['U'][] = $oArquivoAtualizado->sArquivo;
         }
         if (!empty($sArquivosAtualizados)) {
             $sStatusOutput .= "\n- Arquivos Atualizados: ";
             $sStatusOutput .= "\n <info>{$sArquivosAtualizados}</info>\n";
         }
     }
     /**
      * Adicionados
      * - arquivos adicionados e ainda n?o commitados
      */
     if ($lAdicionados) {
         $sArquivosAdicionados = '';
         foreach ($aAdicionados as $oArquivoAdicionado) {
             if (in_array($oArquivoAdicionado->sArquivo, $aArquivosParaCommit)) {
                 continue;
             }
             $sArquivosAdicionados .= "\n " . $oArquivoAdicionado->sArquivo;
             $aTabelaModificacoes['A'][] = $oArquivoAdicionado->sArquivo;
         }
         if (!empty($sArquivosAdicionados)) {
             $sStatusOutput .= "\n- Arquivos adicionados: ";
             $sStatusOutput .= "\n  <info>{$sArquivosAdicionados}</info>\n";
         }
     }
     /**
      * Removidos
      * - arquivos removidos e ainda não commitados
      */
     if ($lRemovidos) {
         $sArquivosRemovidos = '';
         foreach ($aRemovidos as $oArquivoRemovido) {
             if (in_array($oArquivoRemovido->sArquivo, $aArquivosParaCommit)) {
                 continue;
             }
             $sArquivosRemovidos .= "\n " . $oArquivoRemovido->sArquivo;
             $aTabelaModificacoes['R'][] = $oArquivoRemovido->sArquivo;
         }
         if (!empty($sArquivosRemovidos)) {
             $sStatusOutput .= "\n- Arquivos marcados como removido: ";
             $sStatusOutput .= "\n <info>{$sArquivosRemovidos}</info>\n";
         }
         $sArquivosRemovidosLocal = '';
         foreach ($aRemovidosLocal as $oArquivoRemovidoLocal) {
             if (in_array($oArquivoRemovidoLocal->sArquivo, $aArquivosParaCommit)) {
                 continue;
             }
             $sArquivosRemovidosLocal .= "\n " . $oArquivoRemovidoLocal->sArquivo;
             $aTabelaModificacoes['-'][] = $oArquivoRemovidoLocal->sArquivo;
         }
         if (!empty($sArquivosRemovidosLocal)) {
             $sStatusOutput .= "\n- Arquivos removidos do projeto local: ";
             $sStatusOutput .= "\n <error>{$sArquivosRemovidosLocal}</error>\n";
         }
     }
     /**
      * Tabela
      * - Lista modificações em tableas
      */
     if ($lTabela) {
         $oTabela = new \Table();
         $oTabela->setHeaders(array('Tipo', 'Arquivo'));
         foreach ($aTabelaModificacoes as $sTipo => $aArquivosModificacao) {
             $sTipoModificacao = "[{$sTipo}] " . strtr($sTipo, $this->aTiposCommit);
             foreach ($aArquivosModificacao as $sArquivoModificacao) {
                 $oTabela->addRow(array($sTipoModificacao, $sArquivoModificacao));
             }
         }
         if (!empty($aTabelaModificacoes)) {
             $sStatusOutputTabela .= "\nModificações nao tratadas: \n";
             $sStatusOutputTabela .= $oTabela->render();
         }
     }
     /**
      * Push
      * - arquivos para commit
      */
     if ($lPush) {
         /**
          * Tabela
          * - Lista arquivos prontos para commit em tabela
          */
         if ($lTabela) {
             $oTabelaCommit = new \Table();
             $oTabelaCommit->setHeaders(array('Arquivo', 'Tag Mensagem', 'Tag Arquivo', 'Mensagem', 'Tipo'));
             foreach ($aArquivos as $oCommit) {
                 $sTipo = $oCommit->getTipo();
                 switch ($oCommit->getComando()) {
                     case Arquivo::COMANDO_ADICIONAR_TAG:
                         $sTipo = 'Adicionar tag';
                         break;
                     case Arquivo::COMANDO_REMOVER_TAG:
                         $sTipo = 'Remover tag';
                         break;
                 }
                 $oTabelaCommit->addRow(array($this->getApplication()->clearPath($oCommit->getArquivo()), $oCommit->getTagMensagem(), $oCommit->getTagArquivo(), $oCommit->getMensagem(), $sTipo));
             }
             if (!empty($aArquivos)) {
                 $sStatusOutputTabela .= "\nArquivos prontos para commit: \n";
                 $sStatusOutputTabela .= $oTabelaCommit->render();
             }
         }
         /**
          * Sem tabela
          * - Lista arquivos prontos para commit em linha
          */
         if (!$lTabela) {
             foreach ($aArquivos as $oCommit) {
                 $sListaArquivos .= "\n " . $this->getApplication()->clearPath($oCommit->getArquivo()) . " ";
             }
             if (!empty($sListaArquivos)) {
                 $sStatusOutput .= "\n- Arquivos prontos para commit: ";
                 $sStatusOutput .= "\n <info>{$sListaArquivos}</info>\n";
             }
         }
     }
     /**
      * Nenhuma modifiação encontrada
      */
     if (empty($sStatusOutput) && empty($sStatusOutputTabela)) {
         $oOutput->writeln('Nenhuma modificação encontrada');
         return 0;
     }
     if ($lTabela) {
         $sStatusOutput = $sStatusOutputTabela;
     }
     $sStatusOutput = ltrim($sStatusOutput, "\n");
     $oOutput->writeln($sStatusOutput);
 }
Example #11
0
$t->add_cell('Pastor');
$t->add_cell('Rev. Dr. Thomas Evans (a.k.a. Pastor Tom)');
$t->add_cell('(407) 277-4351');
$t->add_cell('<a href="mailto:pastor@sspch.org">pastor@sspch.org</a>');
$t->add_row();
$t->add_cell('Director of Music');
$t->add_cell('Jill Heckert');
$t->add_cell('(407) 496-1289');
$t->add_cell('<a href="mailto:music@sspch.org">music@sspch.org</a>');
$t->add_row();
$t->add_cell('Clerk of Session');
$t->add_cell('Georgia Rife');
$t->add_cell('N/A');
$t->add_cell('<a href="mailto:clerk@sspch.org">clerk@sspch.org</a>');
$t->add_row();
$contacts = $t->render();
$page->leftcontent = <<<EOF

        <div class="post"> 
          <h4>Staff Contacts</h4> 
          <div class="contentarea"> 
          {$contacts}
          </div> 
        </div> 

EOF;
$page->rightcontent = <<<EOF

      <div>
        <h4>Office Hours</h4>
        <div class="contentarea">
Example #12
0
$rows = $db->query('select * from City', PDO::FETCH_OBJ)->fetchAll();

$table = new Table;

$table->add(
		array(
			array('header' => 'ID', 'value' => function($o) { return $o->ID;}),
			array('header' => function() { return 'Name'; }, 'value' => function($o) {return $o->Name; }),
			array('value' => 'Test Value')
		)
	)
	->setDataSource($rows);

?>

<html>
<head>
	<link rel="stylesheet" type="text/css" href="datatables.css" />
	<link rel="stylesheet" type="text/css" href="datatables_jui.css" />
</head>
<body>
	<? echo $table->render(); ?>
</body>

	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="datatables.js"></script>

	<? echo $table->js(); ?>

</html>
Example #13
0
 public function render($headers = true)
 {
     global $redirectedPackage;
     $results = $this->tableData;
     $this->fields = $results["fieldInfos"];
     foreach ($this->fields as $field) {
         if ($field["type"] == "number" || $field["type"] == "double" || $field["type"] == "integer") {
             $this->headerParams[$field["name"]]["type"] = "number";
         }
     }
     $this->headers = $results["headers"];
     array_shift($this->headers);
     if ($headers === true) {
         $table = $this->renderHeader();
     }
     if ($this->useAjax) {
         $table .= "<tr>\n                <td align='center' colspan='" . count($this->headers) . "'>\n                    <img style='margin:80px' src='/" . Application::getLink(Application::getWyfHome("tapi/images/loading-image-big.gif")) . "' />\n                </td></tr>";
     } else {
         $this->data = $results["data"];
         $table .= parent::render(false);
     }
     if ($headers === true) {
         $table .= $this->renderFooter();
     }
     if ($this->useAjax) {
         $this->params['redirected_package'] = $redirectedPackage;
         $table .= "<div id='{$this->name}-operations'></div>\n            <script type='text/javascript'>\n                wyf.tapi.addTable('{$this->name}',(" . json_encode($this->params) . "));\n                var externalConditions = [];\n                var externalBoundData = [];\n                function {$this->name}Search()\n                {\n                    var conditions = '';\n                    var boundData = [];\n                    {$this->searchScript}\n                    wyf.tapi.tables['{$this->name}'].filter = conditions;\n                    wyf.tapi.tables['{$this->name}'].bind = boundData;\n                    if(externalConditions['{$this->name}'])\n                    {\n                        wyf.tapi.tables['{$this->name}'].filter += ((conditions != '' ?' AND ':'') + externalConditions['{$this->name}']);\n                        wyf.tapi.tables['{$this->name}'].bind = boundData.concat(externalBoundData);\n                    }\n                    wyf.tapi.tables['{$this->name}'].page = 0;\n                    wyf.tapi.render(wyf.tapi.tables['{$this->name}']);\n                }\n            </script>";
     }
     return $table;
 }