public function action_index() { $content = array(); if (isset($_GET["auto_modeler"])) { if (empty($_GET["auto_modeler"])) { $this->auto_modeler(); } else { $this->auto_modeler($_GET["auto_modeler"]); } } if (isset($_GET["remove_models"])) { if (empty($_GET["remove_models"])) { $this->remove_models(); } else { $this->remove_models($_GET["remove_models"]); } } $subPath = isset($_GET["dir"]) ? $_GET["dir"] : ""; $path = APPPATH . 'classes' . DIRECTORY_SEPARATOR . "model" . DIRECTORY_SEPARATOR . "scaffold" . DIRECTORY_SEPARATOR . $subPath; if (!is_dir($path)) { mkdir($path, 0777, TRUE); } if ($handle = opendir($path)) { $files = array(); $directores = array(); while (FALSE !== ($file = readdir($handle))) { if (preg_match("/" . EXT . "/i", $file)) { array_push($files, str_replace(EXT, "", $file)); } else { if (!preg_match("/\\./i", $file)) { array_push($directores, str_replace(EXT, "", $file)); } } } closedir($handle); foreach ($directores as $item) { $item_name = str_replace(array($path, EXT), "", $item); // array_push( $content, HTML::anchor('scaffold?dir='.$item_name, "[+] " . ucfirst($item_name)) ); // array_push( $content, "[+] " . ucfirst($item_name) ); } foreach ($files as $item) { $item_name = str_replace(array($path, EXT), "", $item); array_push($content, HTML::anchor('scaffold/list/' . $subPath . $item_name, ImplodeUppercase::ucwords_text($item_name))); } } if (empty($content)) { $content = __("No models to list"); } $data = array("content" => $content, "msg" => isset($_GET["msg"]) ? $_GET["msg"] : "", "msgtype" => isset($_GET["msgtype"]) ? $_GET["msgtype"] : "success"); echo View::factory("scaffold/index", $data)->render(); }
</label></td> <?php $disabled = $item === $first ? "disabled" : ""; ?> <td><?php echo Form::input($item, "", array("id" => $item, "class" => "text", $disabled => $disabled)); ?> </td> </tr> <?php } ?> </tbody> </table> </fieldset> <?php echo Form::close(); ?> </form> <p> <?php echo HTML::anchor('scaffold/list/' . $column, "< " . __("Back") . " " . __("to") . " " . ImplodeUppercase::ucwords_text($column)); ?> </p> </div> <?php echo View::factory("scaffold/snippets/footer")->render(); ?> </body> </html>
echo $column; ?> </title> <?php echo View::factory("scaffold/snippets/head")->render(); ?> </head> <body> <div id="container"> <p> <?php echo HTML::anchor('scaffold', 'Models'); ?> > <strong><?php echo ImplodeUppercase::ucwords_text($column); ?> </strong> </p> <?php $msg = Session::instance()->get("flash.message"); if (!empty($msg)) { foreach ($msg as $item) { echo "<div id=\"msg\" class=\"msg " . $item["type"] . "\">" . $item["msg"] . "<a href=\"./" . $column . "\" id=\"msg-button\">[X]</a></div>"; } Session::instance()->delete("flash.message"); } ?> <p> <?php echo HTML::anchor('scaffold/insert/' . $column, __("Insert"), array("class" => "submit right"));
static function ucwords_text($str) { return str_replace("_", " ", ucwords(strtolower(ImplodeUppercase::decode($str)))); }