public function loadModel($id)
 {
     if (($model = Package::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
 function actionPackage($id = null)
 {
     if ($id == null) {
         $this->render('packages', array('packages' => Package::model()->findAll()));
     } else {
         $c = Package::model()->findByPk($id);
         if ($c == null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
         $this->render('package', array('package' => $c));
     }
 }
 protected function beforeAction($action)
 {
     $actions = array('index');
     if (in_array($action->id, $actions)) {
         $this->package_id = (int) Yii::app()->getRequest()->getParam('package_id');
         if (!$this->package_id) {
             throw new CHttpException(400, 'Не установлен ID пакета');
         }
         if (($this->package = Package::model()->findByPk($this->package_id)) === null) {
             throw new CHttpException(404, 'Пакет не найден');
         }
     }
     return parent::beforeAction($action);
 }
 public function actionShow($alias)
 {
     if (Yii::app()->user->isAuthenticated() === false) {
         $this->controller->redirect(Yii::app()->user->loginUrl);
     }
     if (($user = Yii::app()->user->getProfile()) === null) {
         Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::ERROR_MESSAGE, Yii::t('UserModule.user', 'User not found.'));
         Yii::app()->user->logout();
         $this->controller->redirect((array) '/user/account/login');
     }
     $course = Course::model()->published()->find('t.alias = :alias', array(':alias' => $alias));
     if (!$course) {
         throw new CHttpException(404);
     }
     // ToDO
     // Пакет
     $package = Package::model()->findByPK(1);
     // День
     $dayId = Yii::app()->getRequest()->getParam('day', null);
     if ($dayId) {
         $day = Day::model()->published()->package($package->id)->findByPK((int) $dayId);
     } else {
         $day = Day::model()->published()->package($package->id)->find(array('order' => 't.number ASC'));
     }
     if (!$day) {
         throw new CHttpException(404);
     }
     // Страница
     $pageId = Yii::app()->getRequest()->getParam('page', null);
     if ($pageId) {
         $page = Page::model()->published()->day($day->id)->findByPK((int) $pageId);
     } else {
         $page = Page::model()->published()->day($day->id)->find(array('order' => 't.number ASC'));
     }
     if (!$page) {
         throw new CHttpException(404);
     }
     // Вывод в шаблон
     $this->render('show', array('course' => $course, 'package' => $package, 'day' => $day, 'page' => $page));
 }
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     if (isset($_REQUEST['add_package'])) {
         $class = Package::model()->findByPk($_REQUEST['add_package']);
         if ($class != null) {
             $nm = new ClassRequirement();
             $nm->id_requirement = $model->id_requirement;
             $nm->id_package = $class->id_package;
             $nm->save(false);
         }
     }
     if (isset($_REQUEST['add_class'])) {
         $class = Class_Prog::model()->findByPk($_REQUEST['add_class']);
         if ($class != null) {
             $nm = new ClassRequirementReal();
             $nm->id_requirement = $model->id_requirement;
             $nm->id_class = $class->id_class;
             $nm->save(false);
         }
     }
     $this->render('view', array('model' => $model));
 }
<?php

function component_row(Package $package, $indentation, TableCreator $table_creator)
{
    $package->with('integration');
    $ret = $table_creator->row(array($package->full_name(), $package->integration == null ? 'Architettura del sistema' : $package->integration->public_id()));
    $nested = $package->with('packages')->packages;
    foreach ($nested as $nuc) {
        $ret .= component_row($nuc, $indentation + 1, $table_creator);
    }
    return $ret;
}
$comps = Package::model()->findAll("parent is null and name != 'Qt'");
$table = $table_creator->begin_table("|l|l|") . $table_creator->heading_row(array("Componente", "Test"));
foreach ($comps as $package) {
    $package->with('integration');
    $table .= component_row($package, 0, $table_creator);
}
$table .= $table_creator->caption("Tabella componente / test di integrazione") . $table_creator->end_table();
if ($table_creator->id() != 'html' && !$raw) {
    echo CodeGen::generic_render_code($table, 'latex', true);
} else {
    echo $table;
}
示例#7
0
 static function find_by_qualified_name($name, Package $namespace = null)
 {
     $name = trim($name);
     if (strlen($name) == 0) {
         return null;
     }
     $model = self::model();
     $name_parts = explode('::', $name);
     if (count($name_parts) == 1) {
         if ($namespace != null && !$namespace->isNewRecord) {
             return $model->find('name = :name and id_package = :idp', array('name' => $name, 'idp' => $namespace->id_package));
         }
         return $model->find('name = :name', array('name' => $name));
     }
     $namespace = Package::model()->find('parent is null and name = :name', array('name' => $name_parts[0]));
     for ($i = 1; $i < count($name_parts) - 1; $i++) {
         $namespace = Package::model()->find('parent = :idp and name = :name', array('name' => $name_parts[$i], 'idp' => $namespace->id_package));
     }
     if ($namespace == null) {
         return null;
     }
     return $model->find('name = :name and id_package = :idp', array('name' => $name_parts[count($name_parts) - 1], 'idp' => $namespace->id_package));
 }
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = $this->loadModel($id);
         $currentUp = UpDetail::model()->findAllByAttributes(array('up_number_of_letter' => $model->number_of_letter));
         $latestUP = Up::model()->find(array('order' => 'id DESC'));
         if ($model->number_of_letter != $latestUP->number_of_letter) {
             Yii::app()->user->setFlash('error', 'Sudah ada UP baru. Tidak dapat menghapus UP lama.');
             $this->redirect(array('view', 'id' => $model->id));
         }
         $realization = $model->getTotal($model->number_of_letter)["realization"];
         if ($realization != 0) {
             Yii::app()->user->setFlash('error', 'Tidak dapat menghapus UP yang sudah terrealisasi.');
             $this->redirect(array('view', 'id' => $model->id));
         }
         //Delete Detail
         $details = UpDetail::model()->findAllByAttributes(array('up_number_of_letter' => $model->number_of_letter));
         foreach ($details as $detail) {
             //update package UP status to LS
             $package = Package::model()->findByAttributes(array('code' => $detail->package_code));
             $package->up = 'LS';
             $package->update();
             //update package UP status to LS
             $detail->delete();
         }
         //Delete Detail
         $model->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
 /**
  * Clear data on database
  */
 public function actionClear()
 {
     //Check record data on database
     $exist = Package::model()->exists();
     if ($exist) {
         //Clear Data
         Yii::app()->db->createCommand()->truncateTable(Package::model()->tableName());
         Yii::app()->db->createCommand()->truncateTable(PackageAccount::model()->tableName());
         Yii::app()->user->setFlash('success', 'Data berhasil dibersihkan.');
         $this->redirect(array('index'));
     } else {
         Yii::app()->user->setFlash('error', 'Data tidak ditemukan.');
         $this->redirect(array('index'));
     }
 }
 public function actionPpkPackageAccountChart($id, $ppkId)
 {
     $package = Package::model()->findByPk($id);
     $ppk = Ppk::model()->findByPk($ppkId);
     $packageAccounts = PackageAccount::model()->findAllByAttributes(array('package_code' => "{$package->code}", 'ppk_code' => "{$ppk->code}"));
     $this->render('ppkPackageAccountChart', array('ppk' => $ppk, 'package' => $package, 'packageAccounts' => $packageAccounts));
 }
 /**
  * Clear all DIPA, Budget, Package, Account Package, and Realization data from database record
  */
 public function actionClear()
 {
     //Check record data on database
     $realization = Realization::model()->exists();
     $packageAccount = PackageAccount::model()->exists();
     $package = Package::model()->exists();
     $budget = Budget::model()->exists();
     $dipa = Dipa::model()->exists();
     //Clear data
     if ($realization) {
         //Truncate realization table on anggaran database
         Yii::app()->db->createCommand()->truncateTable(Realization::model()->tableName());
     }
     if ($packageAccount) {
         //Truncate package_account table on anggaran database
         Yii::app()->db->createCommand()->truncateTable(PackageAccount::model()->tableName());
     }
     if ($package) {
         //Truncate package table on anggaran database
         Yii::app()->db->createCommand()->truncateTable(Package::model()->tableName());
     }
     if ($budget) {
         //Truncate budget table on anggaran database
         Yii::app()->db->createCommand()->truncateTable(Budget::model()->tableName());
     }
     if ($dipa) {
         //Truncate dipa table on anggaran database
         Yii::app()->db->createCommand()->truncateTable(Dipa::model()->tableName());
     }
     //Redirect to DIPA index page
     Yii::app()->user->setFlash('success', 'Data berhasil dibersihkan. </br> Anda dapat memasukkan anggaran baru.');
     $this->redirect(array('index'));
 }
示例#12
0
    $namespace_array[] = $namespace . $package->name;
    $package->with('packages,classes');
    $sub_scope = $namespace . $package->name . '::';
    if (isset($package->packages)) {
        foreach ($package->packages as $c) {
            ns_build_package($c, $sub_scope, $namespace_array);
        }
    }
    if (isset($package->classes)) {
        foreach ($package->classes as $class) {
            $namespace_array[] = $sub_scope . $class->name;
        }
    }
}
$namespace_array = array();
$packages = Package::model()->findAll('parent is null');
foreach ($packages as $p) {
    ns_build_package($p, "", $namespace_array);
}
?>

<script>
    //highlight
    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
        lineNumbers: true,
        matchBrackets: true,
        mode: "text/x-c++hdr",
        extraKeys: {"Ctrl-Space": "autocomplete"},
        indentUnit: 4,
        indentWithTabs: true,
        theme: 'default',
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->title = 'Daftar Realisasi';
     //Check existed dipa (used to show & hide submit button)
     $showContent = FALSE;
     $parent = Package::model()->exists();
     $errors = ErrorRealization::model()->findAll();
     $limit = array();
     $realization = array();
     $rest = array();
     if ($errors) {
         foreach ($errors as $data) {
             $limit[$data->packageAccount_code] = 0;
             $realization[$data->packageAccount_code] = 0;
             $rest[$data->packageAccount_code] = 0;
             $pAccount = PackageAccount::model()->findByAttributes(array('code' => "{$data->packageAccount_code}"));
             if ($pAccount) {
                 $limit[$data->packageAccount_code] = $pAccount->limit;
                 $realization[$data->packageAccount_code] = PackageAccount::model()->getTotal($pAccount->code)['realization'];
                 $rest[$data->packageAccount_code] = PackageAccount::model()->getTotal($pAccount->code)['restMoney'];
             }
         }
     }
     if ($parent) {
         $showContent = TRUE;
     }
     $model = new Realization('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Realization'])) {
         $model->attributes = $_GET['Realization'];
     }
     $this->render('index', array('model' => $model, 'showContent' => $showContent, 'errors' => $errors, 'limit' => $limit, 'realization' => $realization, 'rest' => $rest));
 }
示例#14
0
<?php

$ass = isset($_GET['ass']) && $_GET['ass'];
$xmi = new XmiRenderer();
$xmi->begin();
$toplevel = Package::model()->findAll('parent is null');
foreach ($toplevel as $pack) {
    $xmi->package($pack, $ass);
}
$xmi->end();
 function actionParentCompletion($term)
 {
     $limit = 10;
     $sql_command = Yii::app()->db->createCommand()->select('name as value, id_package as id')->from('package')->where('name like :txt', array('txt' => "%{$term}%"))->order('name')->limit($limit);
     $matches = $sql_command->queryAll();
     if (count($matches) == 1) {
         $p = Package::model()->findByPk($matches[0]['id']);
         $p->with('packages');
         if (isset($p->packages) && is_array($p->packages)) {
             foreach ($p->packages as $c) {
                 if (count($matches) >= $limit) {
                     break;
                 }
                 array_push($matches, array('value' => $p->name . "::" . $c->name, 'id' => $c->id_package));
             }
         }
     }
     echo json_encode($matches);
 }
示例#16
0
function display_comp($component, TableCreator $table_creator)
{
    $string = '';
    $id = $component->full_name();
    $name = $component->full_name("::\\-");
    //$actors = implode(', ',$useCase->actors());
    $string .= $table_creator->anchor($id, '') . "\n";
    $string .= $table_creator->title(2, $name);
    $string .= $table_creator->title(3, "Informazioni sul package");
    $string .= "\n    \\begin{figure}[H]\n        \\centering\n        \\scalegraphics{img/package/{$component->name}}\n        \\caption{Componente {$name}}\\label{fig:{$id}} \n    \\end{figure}\n    ";
    $string .= $table_creator->title(4, 'Descrizione');
    $string .= $component->description . ". \n";
    $component->with('packages');
    $nested = $component->packages;
    if (count($nested) > 0) {
        $string .= $table_creator->title(4, 'Package contenuti');
        $string .= $table_creator->begin_list();
        foreach ($nested as $nuc) {
            $name = $nuc->full_name();
            $string .= $table_creator->list_item($table_creator->link($name, $name));
        }
        $string .= $table_creator->end_list();
    }
    $allass = $component->get_dependencies(false);
    if (count($allass) > 0) {
        $skip = $component->all_descendant_id();
        $alldep = array();
        foreach ($allass as $dep) {
            if (!in_array($dep['id_from'], $skip)) {
                $alldep[] = $dep['id_from'];
            } else {
                if (!in_array($dep['id_to'], $skip)) {
                    $alldep[] = $dep['id_to'];
                }
            }
        }
        if (count($alldep) > 0) {
            $string .= $table_creator->title(4, 'Interazioni con altri componenti');
            $string .= $table_creator->begin_list();
            foreach ($alldep as $d) {
                $nuc = Package::model()->findByPk($d);
                $name = $nuc->full_name();
                $string .= $table_creator->list_item($table_creator->link($name, $name));
            }
            $string .= $table_creator->end_list();
        }
    }
    $component->with('classes');
    if (count($component->classes) > 0) {
        $string .= $table_creator->title(3, 'Classi');
        //$string .= $table_creator->begin_list();
        foreach ($component->classes as $class) {
            /*$name = $class->full_name();
              $string .= $table_creator->list_item(
                              $table_creator->link($name,$name)
                          );*/
            $string .= display_class($class, $table_creator);
        }
        //$string .= $table_creator->end_list();
    }
    foreach ($nested as $nuc) {
        $string .= display_comp($nuc, $table_creator);
    }
    return $string;
}
 public function getTotal($code)
 {
     $totalRealization = 0;
     $totalRestMoney = 0;
     $models = Package::model()->findAllByAttributes(array('name' => $code));
     foreach ($models as $model) {
         $totalRealization += $model->getTotal($model->code)['realization'];
         $totalRestMoney += $model->getTotal($model->code)['restMoney'];
     }
 }
 public function actionShow($courseAlias, $typeAlias)
 {
     // Авторизован ли пользователь
     if (Yii::app()->user->isAuthenticated() === false) {
         $this->redirect(Yii::app()->user->loginUrl);
     }
     if (($user = Yii::app()->user->getProfile()) === null) {
         Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::ERROR_MESSAGE, Yii::t('UserModule.user', 'User not found.'));
         Yii::app()->user->logout();
         $this->redirect((array) '/user/account/login');
     }
     // Вид курса
     $courseType = CourseType::model()->published()->with('course')->find('course.alias = :courseAlias AND t.alias = :typeAlias', array(':courseAlias' => $courseAlias, ':typeAlias' => $typeAlias));
     if (!$courseType) {
         throw new CHttpException(404);
     }
     if (Yii::app()->user->isSuperUser()) {
         // Админ может просматривать любой тип курса
         if ($_GET['adminPackageId'] != '') {
             $adminPackageId = (int) Yii::app()->getRequest()->getParam('adminPackageId');
             if ($adminPackageId > 0) {
                 Yii::app()->user->setState('adminPackageId', $adminPackageId);
             } else {
                 Yii::app()->user->setState('adminPackageId', null);
             }
         }
         // Админ может просматривать курс с данными  другого пользователя
         if ($_GET['adminUserId'] != '') {
             $adminUserId = (int) Yii::app()->getRequest()->getParam('adminUserId');
             if ($adminUserId > 0) {
                 Yii::app()->user->setState('adminUserId', $adminUserId);
             } else {
                 Yii::app()->user->setState('adminUserId', null);
             }
         }
         // Подмена данных пользователя для администратора
         if (Yii::app()->user->getState('adminUserId') !== null) {
             $viewedUser = User::model()->findByPK((int) Yii::app()->user->getState('adminUserId'));
             if ($viewedUser) {
                 $user->code = $viewedUser->code;
                 $user->profile->setAttributes(array('name' => $viewedUser->profile->name, 'gender' => $viewedUser->profile->gender, 'birth_date' => $viewedUser->profile->birth_date, 'birth_time' => $viewedUser->profile->birth_time, 'city_id' => $viewedUser->profile->city_id));
                 $user->profile->city = $viewedUser->profile->city;
             }
         }
     }
     // Пакет
     if (Yii::app()->user->isSuperUser() && Yii::app()->user->getState('adminPackageId') !== null) {
         // Админ может просмотреть любой пакет
         $packageId = (int) Yii::app()->user->getState('adminPackageId');
         $this->package = Package::model()->published()->findByPK($packageId);
     } else {
         // Остальным подбираем пакет в зависимости от указанных данных
         $this->package = Package::model()->published()->find('t.type_id = :type_id AND t.gender = :gender AND t.notime = :notime', array(':type_id' => $courseType->id, ':gender' => $user->profile->gender, ':notime' => $user->profile->birth_time === null));
     }
     if (!$this->package) {
         throw new CHttpException(404);
     }
     // День
     $dayNumber = (int) Yii::app()->getRequest()->getParam('day', 1);
     $this->day = $day = Day::model()->published()->package($this->package->id)->findByNumber($dayNumber);
     if (!$day) {
         throw new CHttpException(404);
     }
     // Страница
     $pageNumber = (int) Yii::app()->getRequest()->getParam('page', 1);
     $page = Page::model()->published()->day($day->id)->with(array('blocks' => array('scopes' => 'published', 'order' => 'blocks.sort ASC')))->findByNumber($pageNumber);
     if (!$page) {
         throw new CHttpException(404);
     }
     // Определяем, имеет ли пользователь доступ к выбранной странице курса
     $this->_checkPermissions($user, $courseType, $dayNumber, $pageNumber);
     // Запоминаем последнюю прочитанную страницу для пользователя
     LastReadPage::model()->fixLastPage($user, $courseType, $page);
     // Определяем предыдущую и следующую страницы
     $prevPage = $page->getPrevPage();
     $nextPage = $page->getNextPage();
     // Выделяем интересную мысль, если она указана
     $quoteText = '';
     $highlightId = Yii::app()->getRequest()->getParam('highlight', null);
     if (!empty($highlightId)) {
         $quote = Quote::model()->findByPk($highlightId);
         $quoteText = $quote ? $quote->content : '';
     }
     // Вывод в шаблон
     $this->render('show', array('package' => $this->package, 'day' => $day, 'page' => $page, 'nextPage' => $nextPage, 'prevPage' => $prevPage, 'quoteText' => $quoteText));
 }
示例#19
0
 public function getPackageOptions()
 {
     $models = Package::model()->findAll();
     $options = array();
     foreach ($models as $model) {
         $options[$model->code] = "[{$model->code}] | {$model->name}";
     }
     return $options;
 }
示例#20
0
 function append_namespace($name)
 {
     if (count($this->namespace) == 0) {
         $ns = Package::model()->find('parent is null and name = :name', array('name' => $name));
     } else {
         $prev = $this->namespace[count($this->namespace) - 1];
         if (isset($prev->id_package)) {
             $ns = Package::model()->find('parent = :pid and name = :name', array('pid' => $prev->id_package, 'name' => $name));
         }
     }
     if ($ns == null) {
         $ns = new Package();
         $ns->name = $name;
     }
     $this->namespace[] = $ns;
 }
示例#21
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'up-detail-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>

<?php 
// echo $form->errorSummary($model);
?>

<div>
    <div ><?php 
echo $form->dropDownListRow($model, "package_code", Package::model()->getPackageOptions(), array("prompt" => "Pilih Paket", "labelOptions" => array('label' => false), "style" => "display: block; width: 100%"));
?>
</div>
    <div><?php 
echo $form->textFieldRow($model, 'limit', array('class' => 'span12', "placeholder" => "Pagu UP", "labelOptions" => array('label' => false)));
?>
</div>
    <div>
        <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Tambah' : 'Simpan'));
?>
    </div>
</div>
<?php 
$this->endWidget();
示例#22
0
    foreach ($class->methods as $meth) {
        $string .= test_row($meth, $table_creator);
    }
    return $string;
}
function display_comp(Package $component, TableCreator $table_creator)
{
    $string = "";
    $component->with('classes');
    foreach ($component->classes as $class) {
        $string .= display_class($class, $table_creator);
    }
    $component->with('packages');
    $nested = $component->packages;
    foreach ($nested as $nuc) {
        $string .= display_comp($nuc, $table_creator);
    }
    return $string;
}
$sourceArray = array();
$toplevel = Package::model()->findAll('parent is null and name != "Qt"');
$table = $table_creator->begin_table("|p{11cm}|p{2cm}|") . $table_creator->heading_row(array("Metodo", "Test"));
foreach ($toplevel as $component) {
    $table .= display_comp($component, $table_creator);
}
$table .= $table_creator->caption("Tabella metodi / test unità") . $table_creator->end_table();
if (!$raw && $table_creator->id() == 'latex') {
    echo CodeGen::generic_render_code($table, 'latex', true);
} else {
    echo $table;
}
示例#23
0
 function xerrente($id_this, $id_that, $skip_id = null)
 {
     $dependencies = $this->get_dependencies();
     if (!is_array($skip_id)) {
         $skip_id = $this->all_descendant_id();
         $lib = Package::model()->find('name="Qt"');
         if ($lib != null) {
             $skip_id[] = $lib->id_package;
         }
     }
     $val = 0;
     foreach ($dependencies as $d) {
         if ($d[$id_this] == $this->id_package && !in_array($d[$id_that], $skip_id)) {
             $val++;
         }
     }
     $this->with('packages');
     foreach ($this->packages as $p) {
         $val += $p->xerrente($id_this, $id_that, $skip_id);
     }
     return $val;
 }
<?php

function component_row(Package $component, $indentation, TableCreator $table_creator)
{
    $req_id = array();
    $component->with('requirements');
    foreach ($component->requirements as $rq) {
        array_push($req_id, $table_creator->link($rq->public_id(), $rq->public_id()));
    }
    array_unique($req_id);
    $cells = array($table_creator->child_indentation($indentation), $table_creator->link($component->full_name(), $component->full_name("::\\-")), implode("\n\n", $req_id));
    $ret = $table_creator->row($cells);
    $nested = $component->with('packages')->packages;
    foreach ($nested as $nuc) {
        $ret .= component_row($nuc, $indentation + 1, $table_creator);
    }
    return $ret;
}
$table = $table_creator->begin_table("|r l|p{3cm}|") . $table_creator->heading_row(array("Componenti" => 2, "Requisiti"));
$toplevel = Package::model()->findAll("t.parent is null and t.name!='Qt'");
foreach ($toplevel as $req) {
    $table .= component_row($req, 0, $table_creator);
}
$table .= $table_creator->caption("Tabella componenti / requisiti") . $table_creator->end_table();
if ($table_creator->id() != 'html' && !$raw) {
    echo CodeGen::generic_render_code($table, 'latex', true);
} else {
    echo $table;
}