function list_data_radio($hal = 0) { $_SESSION[setting_radiologi_spesimen][hal] = $hal; $objResponse = new xajaxResponse(); $paging = new MyPagina; $paging->rows_on_page = 15; $paging->sql = " SELECT rp.id as id, rp.nama as nama, rp.biaya_bhp as biaya_bhp, rpd.biaya_jasa as biaya_jasa, rpd.kelas as kelas FROM radio_pemeriksaan rp JOIN radio_pemeriksaan_detil rpd ON (rpd.tingkat = rp.tingkat) ORDER BY rp.nama "; $paging->hal = $hal; $paging->get_page_result(); $data = $paging->data; $no = $paging->start_number(); $navi = $paging->navi(); $table = new Table; $table->tbody_height = 350; $table->addTh( "No", "Nama", "Biaya BHP", "Biaya Jasa", "Kelas", "Hapus" ); //$table->addExtraTh("style=\"width:50px;\"","style=\"width:200px;\"","","",""); //$kon = new Konek; for($i=0;$i<sizeof($data);$i++) { $table->addRow( ($no+$i), $data[$i][nama], $data[$i][biaya_bhp], $data[$i][biaya_jasa], $data[$i][kelas], "<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_kamar('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>" ); $table->addOnclickTd( "xajax_get_info('".$data[$i][id]."')", "xajax_get_info('".$data[$i][id]."')", "xajax_get_info('".$data[$i][id]."')", "xajax_get_info('".$data[$i][id]."')", "xajax_get_info('".$data[$i][id]."')" ); } $buka = $table->build(); $objResponse->addAssign("list_data_radio", "innerHTML", $buka); $objResponse->addAssign("navi", "innerHTML", $navi); return $objResponse; }
public function __construct(Database $database, Table $table, $info) { // Table $this->table = $table; // Name $this->name = $info->Field; // Type $this->parse_type($info->Type); // Default $this->default_value = $info->Default; // Primary key if (strtoupper($info->Key) == 'PRI') { $this->is_primary_key = true; if ($info->Extra == 'auto_increment') { $this->is_auto_increment = true; } } // Unique key if (strtoupper($info->Key) == 'UNI') { $this->is_unique = true; } // Comment $this->comment = $info->Comment; // Collation $this->collation = $info->Collation; // NULL? $this->nullable = $info->Null == 'YES'; // Is this a foreign key? if (in_array($this->name, $table->get_foreign_key_names())) { $referencedTables = $table->get_referenced_tables(false); $this->references = $referencedTables[$this->name]; } }
public function getPrimaryKeyDDL(Table $table) { if ($table->hasPrimaryKey()) { $pattern = 'CONSTRAINT %s PRIMARY KEY (%s)'; return sprintf($pattern, $this->quoteIdentifier($this->getPrimaryKeyName($table)), $this->getColumnListDDL($table->getPrimaryKey())); } }
/** * Tests toPhpUnitTable. */ public function testToPhpUnitTable() { $table = new Table(new Test(new ReflectionMethod(__CLASS__, __FUNCTION__)), 'dbName', 'tableName'); $result = $table->toPhpUnitTable(); $this->assertInstanceOf('PHPUnit_Extensions_Database_DataSet_ITable', $result); $this->assertSame('dbName.tableName', $result->getTableMetaData()->getTableName()); }
public function getHtml() { $trace = $this->trace->addChild("HodnoteniaCallback"); $hodnotenia = $this->app->getHodnotenia($trace); $hodnoteniaTable = new Table(TableDefinitions::hodnotenia()); $priemeryCalculator = new PriemeryCalculator(); foreach (Sorter::sort($hodnotenia->getData(), array("semester" => -1, "nazov" => 1)) as $row) { if ($row['semester'] == 'L') { $class = 'leto'; $priemeryCalculator->add(PriemeryCalculator::SEMESTER_LETNY, $row['znamka'], $row['kredit']); } else { $class = 'zima'; $priemeryCalculator->add(PriemeryCalculator::SEMESTER_ZIMNY, $row['znamka'], $row['kredit']); } $hodnoteniaTable->addRow($row, array('class' => $class)); } $hodnoteniaCollapsible = new Collapsible(new HtmlHeader('Hodnotenia'), $hodnoteniaTable); $priemery = $this->app->getPriemery($trace); $priemeryTable = new Table(TableDefinitions::priemery()); $priemeryTable->addRows($priemery->getData()); $priemeryContainer = new Container(); $priemeryContainer->addChild(new Label('Nasledovné priemery sú prebraté z AISu, čiže to (ne)funguje presne rovnako:')); $priemeryContainer->addChild($priemeryTable); if ($priemeryCalculator->hasPriemer()) { $priemeryFajrText = '<p><br />Nasledovné vážené študijné priemery sú počítané Fajrom priebežne z tabuľky Hodnotenia, <strong>preto nemôžu byť považované ako oficiálne</strong>:<br /><br />'; $priemeryFajrText .= $priemeryCalculator->getHtml(); $priemeryFajrText .= '</p>'; $priemeryContainer->addChild(new Label($priemeryFajrText)); } $priemeryCollapsible = new Collapsible(new HtmlHeader('Priemery'), $priemeryContainer); return $hodnoteniaCollapsible->getHtml() . $priemeryCollapsible->getHtml(); }
public function display() { $form = new Form(2); $form->submit(); $GLOBALS['editinglanguage'] = new Language($_GET['language']); $table = new Table(); $token = new TableColumn("token", "Token"); $translation = new TableFunctionColumn("token", Language::DirectTranslate("TRANSLATION")); $translation->functionName = "TranslationEditor_GetString"; $translation->autoWidth = true; $languagetoken = new TableColumn("'" . DataBase::Current()->EscapeString($_GET['language']) . "' as language", "Language"); $languagetoken->value = $_GET['language']; $languagetoken->visible = false; $table->columns->add($token); $table->columns->add($translation); $table->columns->add($languagetoken); $table->name = "{'dbprefix'}language_tokens"; $table->actions = "translation_tokens"; $table->orderBy = "token"; $table->size = -1; $table->display(); $newModule = Language::DirectTranslateHtml("NEW_MODULE"); echo "<h2>" . $newModule . "</h2>"; $form->display(); }
/** * @param string $columnName * @param string $typeName * @param array $options * * @return Column */ public function addColumn($columnName, $typeName, array $options = array()) { if ($this->connection->getDatabasePlatform()->getName() === 'sqlite' && in_array($typeName, ['string', 'text'])) { $options['customSchemaOptions']['collation'] = 'NOCASE'; } return $this->table->addColumn($columnName, $typeName, $options); }
function list_data($hal = 0) { $_SESSION[hal] = $hal; $objResponse = new xajaxResponse(); $paging = new MyPagina; $paging->rows_on_page = 20; $paging->sql = "SELECT i.id as icid, i.kode as kode, i.nama as nama, id.id as idid, id.* FROM icopim i LEFT JOIN icopim_detil id ON (id.tingkat = i.tingkat) GROUP BY i.id, id.kelas ORDER BY i.nama, id.kelas "; $paging->hal = $hal; $paging->get_page_result(); $data = $paging->data; $no = $paging->start_number(); $navi = $paging->navi(); $tabel = new Table; $tabel->tbody_height = 400; $tabel->addTh( "No", "Kode", "Tindakan", "Tingkat", "Kelas", "Biaya", "Hapus" ); for($i=0;$i<sizeof($data);$i++) { $tabel->addRow( ($no+$i), $data[$i][kode], $data[$i][nama], $data[$i][tingkat], $data[$i][kelas], $data[$i][biaya], "<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_tindakan('".$data[$i][icid]."', '".$data[$i][idid]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>"); $tabel->addOnclickTd( "xajax_get_tindakan('".$data[$i][icid]."', '".$data[$i][tingkat]."', '".$data[$i][kelas]."')", "xajax_get_tindakan('".$data[$i][icid]."', '".$data[$i][tingkat]."', '".$data[$i][kelas]."')", "xajax_get_tindakan('".$data[$i][icid]."', '".$data[$i][tingkat]."', '".$data[$i][kelas]."')", "xajax_get_tindakan('".$data[$i][icid]."', '".$data[$i][tingkat]."', '".$data[$i][kelas]."')", "xajax_get_tindakan('".$data[$i][icid]."', '".$data[$i][tingkat]."', '".$data[$i][kelas]."')", "xajax_get_tindakan('".$data[$i][icid]."', '".$data[$i][tingkat]."', '".$data[$i][kelas]."')" ); } $buka = $tabel->build(); $objResponse->addAssign("list_data", "innerHTML", $buka); $objResponse->addAssign("navi", "innerHTML", $navi); return $objResponse; }
public function Load() { require_once dirname(__FILE__) . "/includes/utils-unset-var.inc.php"; if (!$this->isAjaxPage()) { unsetWspAdminVariables(); } parent::$PAGE_TITLE = __(CONNECT_PAGE_TITLE); $this->setUserRights(""); // Welcome message $this->render = new Table(); $this->render->setWidth("100%"); $connect_box = new RoundBox(RoundBox::STYLE_SECOND, "connect_box", 420, 150); $connect_box->setShadow(true); $connect_box->setValign(RoundBox::VALIGN_CENTER); $connect_table = new Table(); $connect_table->setWidth("100%")->setDefaultAlign(RowTable::ALIGN_LEFT); $admin_pic = new Picture("img/wsp-admin/admin_128.png", 128, 128); $this->auth_obj = new Authentication($this, "connect"); $this->auth_obj->setTableWidth(265); $connect_table->addRowColumns($admin_pic, $this->auth_obj); $connect_box->setContent($connect_table); $this->render->addRow("<br/><br/><br/><br/><br/>"); $this->obj_br_before = new Object(); $this->obj_br_before->setId("divBrBefore"); $this->render->addRow($this->obj_br_before); $this->mod_obj = new Object(); $this->mod_obj->setId("divConfigRecommandation")->setWidth(400); $this->render->addRow($this->mod_obj); $this->render->addRow(""); $this->render->addRow($connect_box, RowTable::ALIGN_CENTER, RowTable::VALIGN_CENTER); $this->render->addRow("<br/>"); }
public function display() { $rolelist = new Template(); $rolelist->load("role_list"); $actions = ActionList::get("rolelist"); if (isset($_POST['insert'])) { $role = new Role(); $role->name = $_POST['insert']; $role->insert(); } if (isset($_GET['delete'])) { $role = new Role(); $role->ID = $_GET['delete']; $role->delete(); } $table = new Table(); $id = new TableColumn("id", Language::DirectTranslate("ID")); $id->autoWidth = true; $name = new TableColumn("name", Language::DirectTranslate("NAME")); $table->columns->add($id); $table->columns->add($name); $table->name = "{'dbprefix'}roles"; $table->actions = "rolelist"; $table->orderBy = "name"; $table->cacheName = "rolelist"; $rolelist->assign_var("TABLE", $table->getCode()); $rolelist->output(); }
function commentform($pageid) { //global $session; $process = new ProcessForm(); $validate = $process::validate(); $postcomment = new Table("Comments"); //Process Page Form if ($process->submitForm()) { /*@setting validation rules*/ $required = array("name", "comment"); $process->errorinfo = array_merge($process->errorinfo, $validate->check_requiredFields($required)); $massage = $process->message("Comment has been successfully submmited."); //$sucessmsg = $_REQUEST["msg"]=$massage; if ($process->successflag) { //put database table here $postcomment::$tablefields = array("Name" => $process->post("name"), "Comment" => $process->post("comment"), "Pageid" => $pageid); /*saved to database*/ $postcomment->save(); //echo "new recored was added with id=".$postcomment->lastInsertedId(); //echo "<br> success happened and all fields are sent to database, Thank you ! :)"; } } $form = new Form("commentform", filter_var($_SERVER['PHP_SELF']) . "?" . filter_var($_SERVER['QUERY_STRING']), "post"); //Company; $form->startForm(); $form->setFormField("", $form->addFormInfo("<h2>Comment Form</h2>")); //Page Title $form->setFormField($form->inputLabel("name", "*Name"), $form->inputField("text", "name", $process->post("name")), $validate->displayErrorField($process->errorinfo, "name")); // Page Content $form->setFormField($form->inputLabel("comment", "*Comment (HTML is not allowed)"), $form->textAreaField("comment", $process->post("comment"), 10, 45, 'placeholder="Type comment here"'), $validate->displayErrorField($process->errorinfo, "comment")); //Submit Form $form->setFormField(null, $form->inputField("hidden", "userid", $process->post("userid", $authorid = "")) . $form->inputField("submit", "submit", "Add Comment")); $form->endForm(); return $form->DisplayFields($GLOBALS["form_labling"], $process->message); }
public function payment($module = '') { global $payment, $language, $PHP_SELF; $instance_sub_table = new Table("cc_payment_methods", "payment_filename"); $DBHandle = DbConnect(); $return = null; $return = $instance_sub_table->Get_list($DBHandle, $QUERY, 0); $this->modules = array(); if (is_array($return)) { foreach ($return as $value) { array_push($this->modules, $value["payment_filename"]); } } $include_modules = array(); if (!empty($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); } else { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); $include_modules[] = array('class' => $class, 'file' => $value); } } for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) { include dirname(__FILE__) . '/../methods/' . $include_modules[$i]['file']; $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'](); } if (!is_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) { $this->form_action_url = $GLOBALS[$module]->form_action_url; } $actived_module = $this->selection(); $payment = $actived_module[0]['id']; }
function createUiContainers(){ $t = new Table(); $t->add($this->_createNameElement(_T("Zone name"),false), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement( _T("Name server"), new InputTpl($this->pn("dnsserver")), $this->_dnRulesTooltip(AllowedDn::RELATIVE|AllowedDn::FQDN) ), array("value" => $this->values["dnsserver"], "required" => True)); $t->add(new TrFormElement( _T("Responsible person e-mail"), new InputTpl($this->pn("mail")), $this->_dnRulesTooltip(AllowedDn::RELATIVE|AllowedDn::FQDN) ), array("value"=>$this->values["mail"], "required" => True)); $t->add(new TrFormElement(_T("Time interval before the zone should be refreshed"), new BindRemainingTimeTpl($this->pn("refresh"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["refresh"]))); $t->add(new TrFormElement(_T("Time interval that should elapse before a failed refresh should be retried"), new BindRemainingTimeTpl($this->pn("retry"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["retry"]))); $t->add(new TrFormElement(_T("Expiry time"), new BindRemainingTimeTpl($this->pn("expiry"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["expiry"]))); $t->add(new TrFormElement(_T("Minimum TTL"), new BindRemainingTimeTpl($this->pn("minttl"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["minttl"]))); $t->add(new TrFormElement(_T("Serial number"), new HiddenTpl($this->pn("serial"))), array("value"=>$this->values["serial"], "required" => True)); return array($this->stackedUi($t)); }
public function mod() { $id_trans = Get::req('id_trans', DOTY_INT, 0); if (isset($_POST['undo'])) { Util::jump_to('index.php?r=alms/transaction/show'); } if (isset($_POST['save']) || isset($_POST['not_paid'])) { $product_to_activate = Get::req('product', DOTY_MIXED, array()); $id_user = Get::req('id_user', DOTY_MIXED, 0); if ($this->model->saveTransaction($product_to_activate, $id_trans, $id_user)) { $this->model->controlActivation($id_trans, isset($_POST['not_paid'])); Util::jump_to('index.php?r=alms/transaction/show&res=ok'); } Util::jump_to('index.php?r=alms/transaction/show&res=err'); } $transaction_info = $this->model->getTransactionInfo($id_trans); $user_info = $this->acl_man->getUser($transaction_info['id_user'], false); $user_info[ACL_INFO_USERID] = $this->acl_man->relativeId($user_info[ACL_INFO_USERID]); require_once _base_ . '/lib/lib.table.php'; $tb = new Table(false, Lang::t('_DETAILS', 'transaction'), Lang::t('_DETAILS', 'transaction')); $ts = array('', '', 'min-cell', 'image'); $th = array(Lang::t('_CODE', 'transaction'), Lang::t('_NAME', 'transaction'), Lang::t('_PRICE', 'transaction'), Lang::t('_MARK_AS_PAID', 'transaction')); $tb->setColsStyle($ts); $tb->addHead($th); foreach ($transaction_info['product'] as $product_info) { $tb->addBody(array($product_info['code'], $product_info['name'], $product_info['price'], Form::getInputCheckbox('product_' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'], 'product[' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'] . ']', 1, $product_info['activated'], $product_info['activated'] ? ' disabled="disabled"' : ''))); } $this->render('mod', array('transaction_info' => $transaction_info, 'user_info' => $user_info, 'tb' => $tb, 'id_trans' => $id_trans)); }
public function __construct(Table $table, $name, array $options = array()) { $columnTypes = array(self::TYPE_COLUMN_FIX_SIZE, self::TYPE_COLUMN_VAR_SIZE, self::TYPE_COLUMN_INDEX); if ($this->isObjectResource($name, $columnTypes)) { parent::__construct($name); return; } $ctx = $table->getContext(); $path = null; $flags = 0; $type = null; foreach (array('path', 'flags', 'type') as $option) { if (isset($options[$option])) { if ($option === 'type') { ${$option} = $this->fetchResource($options[$option], $ctx); } else { ${$option} = $options[$option]; } } } $previous = ini_set('track_errors', '1'); $column = @grn_column_open_or_create($table->getResource(), $name, $path, $flags, $type); ini_set('track_errors', $previous); if (!$column) { throw new Exception($php_errormsg); } parent::__construct($column); }
function createEnumerationTable($enumeration, $dbSchema) { if ($this->is_table_filtered($enumeration['name'])) { $this->logger->log("<br>Ignoriere Enumeration: {$enumeration['name']}"); } $this->logger->log('<br><b>Create Enumeration Tables: ' . $enumeration['name'] . '</b> (' . $enumeration['xmi_id'] . ')'); $table = new Table($enumeration['name']); # read Values $enumType = new EnumType($enumeration['name'], $this->logger); $enumType->setSchemas($this->umlSchema, $dbSchema); $enumType->setId($enumeration['id']); $table->values = $enumType->getValues($enumeration); # definiere Attribute $wert_type = empty($enumType) ? 'chacacter varying' : $enumType->getWertType(); $attribute = new Attribute('wert', $wert_type); $table->addAttribute($attribute); $attribute = new Attribute('beschreibung', 'character varying'); $table->addAttribute($attribute); # definiere Primärschlüssel $table->primaryKey = 'wert'; $this->logger->log($table->values->asTable($table->attributes)); # if ( # $table->values->rows[0][0] != $table->values->rows[0][1] AND # $table->values->rows[0][1] != 'NULL' # ) # definiere Commentare $table->addComment('UML-Typ: Enumeration'); $sql .= $table->asSql(); $this->enumerations[$enumType->name] = $enumType; $this->logger->log('<pre>' . $tableSql . '</pre>'); return $sql; }
public function Load() { parent::$PAGE_TITLE = __(CONFIGURE_BANNED_VISITORS); if (!defined('MAX_BAD_URL_BEFORE_BANNED')) { define("MAX_BAD_URL_BEFORE_BANNED", 4); } $this->array_wsp_banned_users = WspBannedVisitors::getBannedVisitors(); $this->table_ban = new Table(); $this->table_ban->setId("table_ban")->activateAdvanceTable()->activatePagination()->activateSort(2, "desc")->setWidth(500); $this->table_ban->addRowColumns("IP", __(LAST_ACCESS), __(DURATION), __(AUTHORIZE))->setHeaderClass(0); $ban_vistors_obj = new Object("<br/><br/>", $this->table_ban, "<br/><br/>"); $ban_ip_table = new Table(); $form = new Form($this); $this->ip_edt = new TextBox($form); $validation = new LiveValidation(); $validation->addValidatePresence(); $this->ip_edt->setLiveValidation($validation); $this->duration_edt = new TextBox($form); $this->duration_edt->setValue(0); $validation = new LiveValidation(); $validation->addValidatePresence()->addValidateNumericality(true); $this->duration_edt->setLiveValidation($validation); $ip_btn = new Button($form); $ip_btn->setValue(__(BAN_IP))->onClick("onBannedIP")->setAjaxEvent(); $ban_ip_table->addRowColumns("IP : ", $this->ip_edt); $ban_ip_table->addRowColumns(__(DURATION) . " : ", $this->duration_edt); $form->setContent(new Object($ban_ip_table, $ip_btn)); $ban_vistors_obj->add($form, "<br/><br/>"); $this->render = new AdminTemplateForm($this, $ban_vistors_obj); }
public function Load() { parent::$PAGE_TITLE = __(CHANGE_PASSWD); $form = new Form($this, "Form_change_passwd"); if (extension_loaded('openssl')) { //$form->setEncryptObject(new EncryptDataWspObject("change wsp password", 2048)); } $table = new Table(); $table->addRow(); $this->edt_old_passwd = new Password($form, "wsp_old_password"); $this->edt_old_passwd->setFocus(); $live_validation = new LiveValidation(); $live_validation->addValidatePresence()->setFieldName(__(OLD_PASSWD)); $table->addRowColumns(__(OLD_PASSWD) . " : ", $this->edt_old_passwd->setLiveValidation($live_validation))->setStyle("color:black;"); $this->edt_new_passwd = new Password($form, "wsp_new_password"); $live_validation = new LiveValidation(); $live_validation->addValidatePresence()->setFieldName(__(NEW_PASSWD)); $table->addRowColumns(__(NEW_PASSWD) . " : ", $this->edt_new_passwd->setLiveValidation($live_validation))->setStyle("color:black;"); $this->edt_confirm_passwd = new Password($form, "wsp_confirm_password"); $live_validation = new LiveValidation(); $live_validation->addValidatePresence()->setFieldName(__(CONFIRM_PASSWD)); $live_validation->addValidateConfirmation("wsp_new_password"); $table->addRowColumns(__(CONFIRM_PASSWD) . " : ", $this->edt_confirm_passwd->setLiveValidation($live_validation))->setStyle("color:black;"); $table->addRow(); $this->validate_btn = new Button($form); $this->validate_btn->setValue(__(CHANGE_PASSWD))->onClick("onChangePasswd")->setAjaxEvent(); $table->addRow($this->validate_btn)->setColspan(2)->setAlign(RowTable::ALIGN_CENTER); $table->addRow(); $form->setContent($table); $table = new Table(); $table->setWidth("100%"); $table->addRow($form, RowTable::ALIGN_CENTER); $this->render = $table; }
function createUiContainers($editMode = false) { $t = new Table(); $t->add($this->_createNameElement(_T("Host name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("IPv6 address"), new IPv6InputTpl($this->pn("ip"))), array("value" => $this->values["ip"], "required" => true)); return array($this->stackedUi($t)); }
public function testUpdate() { $result = $this->target->createUpdate(); $this->assertSame('UPDATE tableName SET col1 = ?, col2 = ? WHERE id = ?', $result['SQL']); $this->assertSame('sdi', $result['marker']); $this->assertSame(array('col1', 'col2', 'id'), $result['columns']); }
/** * Creates a Datatype object for insertion into the passed table. The table's * database engine type is checked first. This allows database specific data * type instructions to be used. * * @param \Database\Table $table * @param string $name Name of column/data type * @param string $type Data type * @param string $value Default value for column * @return \Database\Datatype Returns an extension of Datatype * @throws \Exception */ public static function factory(Table $table, $name, $type, $value = null) { $engine = $table->db->getDatabaseType(); $alltypes = $table->getDatatypeList(); $type = strtolower($type); if (empty($type)) { throw new \Exception(\t('Data type was empty')); } if (!isset($alltypes[$type])) { throw new \Exception(\t('Unknown data type "%s"', $type)); } $class_name = ucwords($alltypes[$type]); $class_file = PHPWS_SOURCE_DIR . "Global/Database/Datatype/{$class_name}.php"; $engine_file = PHPWS_SOURCE_DIR . "Global/Database/Engine/{$engine}/Datatype/{$class_name}.php"; if (is_file($engine_file)) { $datatype_name = "\\Database\\Engine\\{$engine}\\Datatype\\{$class_name}"; } elseif (is_file($class_file)) { $datatype_name = "\\Database\\Datatype\\{$class_name}"; } else { throw new \Exception(\t('Unknown class name "%s"', $class_name)); } $object = new $datatype_name($table, $name); if ($object->default instanceof \Variable) { $object->setDefault($value); } return $object; }
public function getHtml() { $predmetyZapisnehoListu = $this->skusky->getPredmetyZapisnehoListu(); $predmetyZapisnehoListuTable = new Table(TableDefinitions::predmetyZapisnehoListu()); $predmetyZapisnehoListuCollapsible = new Collapsible('Predmety zápisného listu', $predmetyZapisnehoListuTable); $kreditovCelkomLeto = 0; $kreditovCelkomZima = 0; $pocetPredmetovLeto = 0; $pocetPredmetovZima = 0; foreach (Sorter::sort($predmetyZapisnehoListu->getData(), array("semester" => -1, "nazov" => 1)) as $row) { if ($row['semester'] == 'L') { $pocetPredmetovLeto += 1; $kreditovCelkomLeto += $row['kredit']; $class = 'leto'; } else { $pocetPredmetovZima += 1; $kreditovCelkomZima += $row['kredit']; $class = 'zima'; } $predmetyZapisnehoListuTable->addRow($row, array('class' => $class)); } $pocetPredmetovText = 'Celkom '; $pocetPredmetovText .= FajrUtils::formatPlural($pocetPredmetovLeto + $pocetPredmetovZima, '0 predmetov', '1 predmet', '%d predmety', '%d predmetov'); if ($pocetPredmetovLeto > 0 && $pocetPredmetovZima > 0) { $pocetPredmetovText .= sprintf(' (%d v zime, %d v lete)', $pocetPredmetovZima, $pocetPredmetovLeto); } $kreditovCelkomText = '' . ($kreditovCelkomLeto + $kreditovCelkomZima); if ($kreditovCelkomLeto > 0 && $kreditovCelkomZima > 0) { $kreditovCelkomText .= sprintf(' (%d+%d)', $kreditovCelkomZima, $kreditovCelkomLeto); } $predmetyZapisnehoListuTable->addFooter(array('nazov' => $pocetPredmetovText, 'kredit' => $kreditovCelkomText), array()); $predmetyZapisnehoListuTable->setUrlParams(array('studium' => Input::get('studium'), 'list' => Input::get('list'))); return $predmetyZapisnehoListuTable->getHtml(); }
function createUiContainers() { $t = new Table(); $t->add($this->_createNameElement(_T("Name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Canonical name"), new InputTpl($this->pn("cname")), $this->_dnRulesTooltip(AllowedDn::RELATIVE)), array("value" => $this->values["cname"], "extra" => "." . $this->zone, "required" => True)); return array($this->stackedUi($t)); }
function createTableFirstPagePic64($array_link) { $ind = 0; $row_table = null; $table = new Table(10, 10); for ($i = 0; $i < sizeof($array_link); $i++) { if ($array_link[$i]->getUserHaveRights()) { if ($ind % 5 == 0) { if ($row_table != null) { $table->addRow($row_table); } $row_width = 20; if (sizeof($array_link) < 5) { $row_width = 100 / sizeof($array_link); } $row_table = new RowTable(RowTable::ALIGN_CENTER, $row_width . "%"); } $row_table->add($array_link[$i]); $ind++; } } if ($row_table != null) { $table->addRow($row_table); } return $table; }
/** * Get menu * * @param string $category Category name */ public static function get($category = '') { // Get menu table $menu = new Table('menu'); // Display view View::factory('box/menu/views/frontend/index')->assign('items', $menu->select('[category="' . $category . '"]', 'all', null, array('id', 'name', 'link', 'target', 'order', 'category'), 'order', 'ASC'))->assign('uri', Uri::segments())->assign('defpage', Option::get('defaultpage'))->display(); }
function createUiContainers() { $subtypesMap = $this->subtypes(); $subtypes = array_values($subtypesMap); if (isset($subtypesMap[$this->values["subtype"]])) { $subtypeIndex = array_search($subtypesMap[$this->values["subtype"]], $subtypes); $customSubtype = ""; } else { $subtypeIndex = count($subtypes) - 1; $customSubtype = $this->values["subtype"]; } $isCustomSubtype = $subtypeIndex == count($subtypes) - 1 ? "checked" : ""; $subtypeComboBox = new ExtendedSelectItem($this->pn("subtype")); $subtypeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("subtypediv") . "',state);\""); $subtypeComboBox->setElements(array_values($subtypes)); $subtypeComboBox->setElementsVal(array_keys($subtypes)); $t1 = new Table(); $t1->add($this->_createNameElement(_T("Owner name"), true, "/(@|[a-z0-9][a-z0-9-_.]*[a-z0-9]\$)/"), array("value" => $this->hostname, "required" => True)); $t1->add(new TrFormElement(_T("Subtype"), $subtypeComboBox), array("value" => $subtypeIndex)); $subtypeDiv = new Div(array("id" => $this->pn("subtypediv"))); $subtypeDiv->setVisibility($isCustomSubtype); $t2 = new Table(); $t2->add(new TrFormElement(_T("Custom subtype"), new InputTpl($this->pn("customsubtype"), '/^([0-5]?\\d?\\d?\\d?\\d|6[0-4]\\d\\d\\d|65[0-4]\\d\\d|655[0-2]\\d|6553[0-5])$/'), array("tooltip" => _T("Custom subtype ranges from 0 to 65535"))), array("value" => $customSubtype)); $t3 = new Table(); $t3->add(new TrFormElement(_T("Domain name of a host that has a server for the cell named by the owner name"), new InputTpl($this->pn("ownernamehost")), $this->_dnRulesTooltip()), array("value" => $this->values["ownernamehost"], "required" => True)); return array($this->stackedUi($t1), $this->stackedUi($subtypeDiv, 0), $this->stackedUi($t2, 2), $this->stackedUi($t3)); }
function getTransactedSQL( QueryTransactionInformation $transactionInformation, array $selectFields, Table $table, array $restrictions, array $orderBy = array(), $count = - 1, $offset = 0 ) { $tableNames = array( $table->getIdentifier() ); if ( $table->isVersioned ) { $restrictions[] = $transactionInformation->getRestriction( $table ); $tableNames = array_merge( $tableNames, $transactionInformation->getTables() ); $orderBy = array_merge( $orderBy, $transactionInformation->versioningOrderBy() ); $groupBy = $transactionInformation->versioningGroupBy( $table ); $selectFields = array_merge( $selectFields, $transactionInformation->versioningFields( $table->getIdentifier() ) ); } else { $groupBy = array(); } $query = "SELECT " . implode( ", ", $selectFields ) . " FROM " . implode( ", ", $tableNames ); if ( count( $restrictions ) > 0 ) { $query .= " WHERE " . implode( ' AND ', $restrictions ); } if ( count( $groupBy ) > 0 ) { $query .= " GROUP BY " . implode( ', ', $groupBy ); } if ( count( $orderBy ) > 0 ) { $query .= " ORDER BY " . implode( ', ', $orderBy ); } if ( $count != - 1 ) { $query .= " LIMIT " . $offset . ", " . $count; } return $query; }
function group_table() { $group_table = ''; $this->images['edit'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit.png', 'Eigenschaften bearbeiten', array('title' => 'Eigenschaften bearbeiten')); $this->images['apply'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/apply.png', 'Speichern'); $this->images['apply_path'] = '/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/apply.png'; $this->images['checkbox_disabled_unchecked'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/checkbox_disabled_unchecked.png', 'Nicht erlaubt'); $this->images['checkbox_disabled_checked'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/checkbox_disabled_checked.png', 'Erlaubt'); $this->images['new_group'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/add_group.png', 'Gruppe hinzufügen', array('title' => 'Gruppe hinzufügen')); $this->images['delete_group'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/delete_group.png', 'Gruppe löschen', array('title' => 'Gruppe löschen')); $img_group = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit_group.png', 'Gruppe'); $cols = count($this->rechte) + 3; $table = new Table($cols, array('id' => 'groups_table')); $form_tag = Form::form_tag('/Admin/Gruppen'); $form_close = Form::close_form(); $th = array(Html::bold('Gruppe')); foreach ($this->rechte as $recht) { $th[] = $recht['RechtName']; } $table->add_th($th); for ($i = 0; $i < count($this->existent_groups); $i++) { if (isset($_GET['editgroup']) && $_GET['editgroup'] == $i) { $td = array(Form::add_input('text', 'name', $this->existent_groups[$i]['Name'])); for ($j = 0; $j < count($this->rechte); $j++) { if (in_array($this->rechte[$j]['id'], $this->existent_groups[$i]['Rechte'])) { $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id'], array('checked' => 'checked')); } else { $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id']); } } $id = Form::add_input('hidden', 'group_id', $i); $new_rechte_submit = Form::add_input('image', 'submit_rechte', 'Speichern', array('src' => $this->images['apply_path'], 'alt' => 'Speichern')); $td[] = $id . $new_rechte_submit; } else { $td = array(Html::bold($this->existent_groups[$i]['Name'])); for ($j = 0; $j < count($this->rechte); $j++) { $td[] = in_array($this->rechte[$j]['id'], $this->existent_groups[$i]['Rechte']) ? $this->images['checkbox_disabled_checked'] : $this->images['checkbox_disabled_unchecked']; } $edit_button = Html::a('/Admin/Gruppen?editgroup=' . $i, $this->images['edit'], array('title' => 'Eigenschaften bearbeiten')); $delete_button = Html::a('/Admin/Gruppen?deletegroup=' . $i, $this->images['delete_group'], array('title' => 'Gruppe löschen', 'onclick' => "return confirm('Gruppe " . $this->existent_groups[$i]['Name'] . " löschen?')")); $td[] = $edit_button; $td[] = $delete_button; } $class = is_int($i / 2) ? 'abwechselnde_flaechen_1' : 'abwechselnde_flaechen_2'; $table->add_td($td, array('class' => is_int($i / 2) ? 'abwechselnde_flaechen_1' : 'abwechselnde_flaechen_2')); } $new_group_button = Html::a('/Admin/Gruppen?newgroup', $this->images['new_group'] . ' Gruppe hinzufügen'); if (isset($_GET['newgroup'])) { $td = array(Form::add_input('text', 'name', 'Name...')); for ($j = 0; $j < count($this->rechte); $j++) { $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id']); } $new_group_submit = Form::add_input('image', 'submit_newgroup', 'Speichern', array('src' => $this->images['apply_path'], 'alt' => 'Speichern')); $td[] = $id . $new_group_submit; $table->add_td($td); } else { $table->add_td(array(array(2 => $new_group_button))); } return $form_tag . $table->flush_table() . $form_close; }
function createUiContainers() { $t = new Table(); $t->add($this->_createNameElement(_T("Domain name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Name server"), new InputTpl($this->pn("dnsserver")), $this->_dnRulesTooltip()), array("value" => $this->values["dnsserver"], "required" => True)); return array($this->stackedUi($t)); }
function recreateIndexesForTable( Table $table, $purpose ) { echo "Dropping indices from table " . $table->getIdentifier() . ".\n"; dropAllIndicesFromTable( $table->getIdentifier() ); echo "Creating new indices for table " . $table->getIdentifier() . ".\n"; addIndexesForTable( $table, $purpose ); }