/**
  * 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');
 }
 /**
  * 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();
 }