/** * Changes an array of pagenames into a table with "edit", "view" and "delete" options */ protected function createPageList($data) { $this->setState('CREATING_PAGE_LIST_TABLE'); //Create new Table item $t = new Table(); //Create new Table $t->createTable("Pagelist"); //Sets that there is no heading row. $t->setHead(false); //Loop Through each page for ($i = 0; $i < count($data); $i++) { //Add Page data for each row. $t->addRow(array($data[$i], "<a href='?system=Editor&page=editor&active=" . $data[$i] . "'>" . $this->localize("Edit") . "</a>", "<a href='?page=" . $data[$i] . "'>" . $this->localize("View") . "</a>", "<a href='?system=Editor&page=delete&active=" . $data[$i] . "'>" . $this->localize("Delete") . "</a>")); } //Creates a table from inserted data $t->runTable(); //Returns the created table. return $t->getTable(); }
/** * Changes an array of pagenames into a table with "edit", "view" and "delete" options */ protected function createUsersList($data) { // Set the state and tell plugins. $this->setState('CREATING_USER_TABLE'); $this->notifyObservers(); //Create new Table item $t = new Table(); //Create new Table $t->createTable("Userslist"); //Sets intial row as headings $t->setHead(false); //Loop Through each page for ($i = 0; $i < count($data); $i++) { //Add Page data for each row. $t->addRow(array($data[$i], "<a href='?system=Users&page=edit&active=" . $data[$i] . "'>" . $this->localize("Edit") . "</a>", "<a href='?system=Users&page=delete&active=" . $data[$i] . "'>" . $this->localize("Delete") . "</a>")); } //Creates a table from inserted data $t->runTable(); //Returns the created table. return $t->getTable(); }
/** * Shows installed plugins. */ public function showPlugins($data) { $this->setState('START_SHOWING_PLUGINS'); //Get the text for above the table of plugins $out = $this->openFile("core/fragments/listTop.phtml"); $out = $this->setTabActive(2, $out); //Create new Table item $t = new Table(); //Create new Table $t->createTable("Modules"); $t->addID("moduleTable"); //Sets intial row as headings $t->setHead(true); $titles = array($this->localize("Module Name"), $this->localize("Change Status"), $this->localize("Updates"), $this->localize("Uninstall")); //Adds a row as titles. $t->addRow($titles); //Loop Through each page for ($i = 0; $i < count($data); $i++) { $link = ""; $uninstall = ""; //Ensure the disabling of plugin is allowed. if (!$data[$i][2]) { $link = "<a href='index.php?system=Modules&page=deactivate&req=" . $data[$i][0] . "'>" . $this->localize("Deactivate") . "</a>"; } if (!$data[$i][1]) { $link = "<a href='index.php?system=ModulesInstall&page=activate&active=" . $data[$i][0] . "'>" . $this->localize("Activate") . "</a>"; } if ($this->getController()->getModel()->checkModForUpdates($data[$i][0])) { $update = "<a style='color: red;' href='index.php?system=Modules&page=updateCheck&req=" . $data[$i][0] . "'>" . $this->localize("Updates Available") . "</a>"; } else { $update = "<a style='color: green;' href='index.php?system=Modules&page=updateCheck&req=" . $data[$i][0] . "'>" . $this->localize("Up to Date") . "</a>"; } if (!$data[$i][2]) { $uninstall = "<a href='index.php?system=Modules&page=uninstall&req=" . $data[$i][0] . "'>" . $this->localize("Uninstall") . "</a>"; } //Create a row $row = array($this->localize($data[$i][0]), $link, $update, $uninstall); //Add Page data for each row. $t->addRow($row); } //Creates a table from inserted data $t->runTable(); //Returns the created table. $out .= $t->getTable(); //Sets the generated content as output $this->setContent($out); //Localise Title $this->setContentTitle($this->localize("Module Manager")); $this->setState('END_SHOWING_PLUGINS'); }
/** * @param $dataSource * @return Table */ private static function createTable($dataSource) { $sourceReader = $dataSource->getSourceReader(); $headerRow = $sourceReader->currentRow(); $table = Table::createTable($headerRow); $sourceReader->moveToNextRow(); while ($sourceReader->isValid()) { $table->addRow($sourceReader->currentRow()); $sourceReader->moveToNextRow(); } return $table; }
public static function createAllRequiredTables() { $tables = array(); foreach (array_keys(self::$modules) as $class) { foreach (call_user_func(array($class, 'getModuleTables')) as $name => $tblStruct) { $tables[$class][$name] = Table::createTable($name, $tblStruct); } } return $tables; }
function setup_database() { global $core_tables; $conn = mysql_up(); require_once 'lib/class_sqlcore.php'; // Create core tables. echo "<b>Creating core tables...</b><br>\n"; foreach ($core_tables as $tblName => $def) { echo Table::createTable($tblName, $def) ? "<font color='green'>OK — {$tblName}</font><br>\n" : "<font color='red'>FAILED — {$tblName}</font><br>\n"; } // Create tables used by modules. echo "<b>Creating module tables...</b><br>\n"; foreach (Module::createAllRequiredTables() as $module => $tables) { foreach ($tables as $name => $tblStat) { echo $tblStat ? "<font color='green'>OK — {$name}</font><br>\n" : "<font color='red'>FAILED — {$name}</font><br>\n"; } } echo "<b>Other tasks...</b><br>\n"; echo SQLCore::syncGameData() ? "<font color='green'>OK — Synchronize game data with database</font><br>\n" : "<font color='red'>FAILED — Error whilst synchronizing game data with database</font><br>\n"; echo SQLCore::installTableIndexes() ? "<font color='green'>OK — applied table indexes</font><br>\n" : "<font color='red'>FAILED — could not apply one more more table indexes</font><br>\n"; echo SQLCore::installProcsAndFuncs(true) ? "<font color='green'>OK — created MySQL functions/procedures</font><br>\n" : "<font color='red'>FAILED — could not create MySQL functions/procedures</font><br>\n"; // Create root user and leave welcome message on messageboard global $rootpass; $rootpass = isset($rootpass) ? $rootpass : '******'; echo Coach::create(array('name' => 'root', 'realname' => 'root', 'passwd' => $rootpass, 'ring' => Coach::T_RING_GLOBAL_ADMIN, 'mail' => '', 'phone' => '', 'settings' => array(), 'def_leagues' => array())) ? "<font color=green>OK — root user created.</font><br>\n" : "<font color=red>FAILED — root user was not created.</font><br>\n"; Message::create(array('f_coach_id' => 1, 'f_lid' => Message::T_BROADCAST, 'title' => 'OBBLM installed!', 'msg' => 'Congratulations! You have successfully installed Online Blood Bowl League Manager. See "about" and "introduction" for more information.')); // Done! mysql_close($conn); return true; }
/** * Create a form for the page. */ protected function singleTable($active, $data) { $this->setState('CREATE_SINGLE_TABLE'); //Create new Table item $t = new Table(); //Create new Table $t->createTable("Template Set"); //Sets intial row as headings $t->setHead(true); //Get update array $u = $this->getController()->getModel()->getUpdateArray(); //Add the heading row. $t->addRow(array($this->localize("Template"), $this->localize("Preview Option"), $this->localize("Activation State"), $this->localize("Update"), $this->localize("Delete Option"))); //Loop Through each page for ($i = 0; $i < count($data); $i++) { $update = "<a href='?system=Template&page=check&active=" . $data[$i]['unix'] . "'>" . $this->localize("Check") . "</a>"; if (isset($u[$data[$i]['unix']])) { if ($u[$data[$i]['unix']]) { $update = "<a style='color:red;' href='?system=Template&page=update&active=" . $data[$i]['unix'] . "'>" . $this->localize("Updates Available") . "</a>"; } else { $update = "<a style='color:green;' href='?system=Template&page=check&active=" . $data[$i]['unix'] . "'>" . $this->localize("Up to Date") . "</a>"; } } else { $update = "<a style='color:green;' href='?system=Template&page=check&active=" . $data[$i]['unix'] . "'>" . $this->localize("Up to Date") . "</a>"; } if ($active == $data[$i]['title']) { $view = "<a href='?system=Template&page=preview&template=" . $data[$i]['unix'] . "'>" . $this->localize("View") . "</a>"; $localize = "<input type='radio' name='template' value=" . $data[$i]['unix'] . " CHECKED/> " . $this->localize("Active"); $delete = $this->localize("Active"); if (file_exists("style/comps/" . $data[$i]['unix'] . "/noDisableStatus.dat")) { $view = ""; $localize = ""; $delete = ""; } //Add Page data for each row. $t->addRow(array($data[$i]['title'], $view, $localize, $update, $delete)); } else { $view = "<a href='?system=Template&page=preview&template=" . $data[$i]['unix'] . "'>" . $this->localize("View") . "</a>"; $localize = "<input type='radio' name='template' value=" . $data[$i]['unix'] . " /> " . $this->localize("Inactive"); $delete = "<a href='?system=Template&page=delete&active=" . $data[$i]['unix'] . "'>" . $this->localize("Delete") . "</a>"; if (file_exists("style/comps/" . $data[$i]['unix'] . "/noDisableStatus.dat")) { $view = ""; $localize = ""; $delete = ""; } //Add Page data for each row. $t->addRow(array($data[$i]['title'], $view, $localize, $update, $delete)); } } //Creates a table from inserted data $t->runTable(); //Return the out data return $t->getTable(); }
public static function installMVs() { global $core_tables; $status = true; foreach ($core_tables as $name => $tbl) { if (!preg_match('/^mv\\_/', $name)) { continue; } // Done in Table::createTable() automatically #if ($delIfExists) { # $status &= mysql_query("DROP TABLE IF EXISTS $name"); #} $status &= Table::createTable($name, $core_tables[$name]); } return $status; }
public static function updateDatabaseVersion($version) { // Drop table and create Table::createTable('version', array('version' => 'MEDIUMINT UNSIGNED NOT NULL')); return "INSERT INTO version (version) VALUES ({$version})"; }