Пример #1
0
 /**
  * Scaffolds a Windows Azure project structure which can be customized before packaging.
  * 
  * @command-name Scaffold
  * @command-description Scaffolds a Windows Azure project structure which can be customized before packaging.
  * 
  * @command-parameter-for $path Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Path|-p Required. The path to create the Windows Azure project structure.
  * @command-parameter-for $scaffolder Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Scaffolder|-s Optional. The path to the scaffolder to use. Defaults to Scaffolders/DefaultScaffolder.phar 
  */
 public function scaffoldCommand($path, $scaffolder, $argv)
 {
     // Default parameter value
     if ($scaffolder == '') {
         $scaffolder = dirname(__FILE__) . '/Scaffolders/DefaultScaffolder.phar';
     }
     $scaffolder = realpath($scaffolder);
     // Verify scaffolder
     if (!is_file($scaffolder)) {
         // require_once 'Zend/Service/Console/Exception.php';
         throw new Zend_Service_Console_Exception('Could not locate the given scaffolder: ' . $scaffolder);
     }
     // Include scaffolder
     $archive = new Phar($scaffolder);
     include $scaffolder;
     if (!class_exists('Scaffolder')) {
         // require_once 'Zend/Service/Console/Exception.php';
         throw new Zend_Service_Console_Exception('Could not locate a class named Scaffolder in the given scaffolder: ' . $scaffolder . '. Make sure the scaffolder package contains a file named index.php and contains a class named Scaffolder.');
     }
     // Cleanup $argv
     $options = array();
     foreach ($argv as $arg) {
         list($key, $value) = explode(':', $arg, 2);
         while (substr($key, 0, 1) == '-') {
             $key = substr($key, 1);
         }
         $options[$key] = $value;
     }
     // Run scaffolder
     $scaffolderInstance = new Scaffolder();
     $scaffolderInstance->invoke($archive, $path, $options);
 }
Пример #2
0
 /**
  * Run Scaffolder
  *
  * @access	private
  * @return	void
  */
 public function generate()
 {
     require_once APPPATH . 'libraries/scaffolder/scaffolder' . EXT;
     $this->_showHeader();
     if (array_key_exists('table', $_POST) && trim($_POST['table']) != "") {
         $table = $_POST['table'];
         $fields = $this->_getFields($table);
         $scaffolder = new Scaffolder();
         $scaffolder->generate($table, $fields);
         $this->_showFooter();
     } else {
         $this->_showTables();
     }
 }
Пример #3
0
<?php

namespace Shibboleth;

/**
 * Scaffold script. Generates the required database models for the Shibboleth
 * plugin. 
 * 
 * Will only run when the server is a test server.
 * 
 * @license see /license.txt
 * @author Laurent Opprecht <*****@*****.**>, Nicolas Rod for the University of Geneva
 */
$dir = dirname(__FILE__);
include_once $dir . '/../init.php';
include_once $dir . '/../app/lib/scaffolder/scaffolder.class.php';
if (!ShibbolethTest::is_enabled()) {
    echo 'This is not a test server';
    die;
}
if (!Shibboleth::session()->is_logged_in()) {
    echo 'Not authorized';
    die;
}
$name = 'user';
$result = Scaffolder::instance()->scaffold($name);
file_put_contents("{$dir}/output/{$name}.class.php", $result);
header('content-type: text/plain');
echo $result;
 /**
  * Outputs the options form on admin.
  *
  * @param array $instance The widget options
  */
 public function form($instance)
 {
     $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
     echo Scaffolder::widgetView('scaffolder/form', array('form' => $this, 'instance' => $instance, 'title' => $title));
 }
Пример #5
0
 public function edit()
 {
     $this->data['table'] = String::clean(Router::uri(3), '_');
     $scaffolder = new Scaffolder($this->data['table'], intval(Router::uri(4)));
     $scaffolder->iterate();
     $this->data['form'] = $scaffolder->display();
     if (isset($_POST['submit'])) {
         if ($scaffolder->save_object()) {
             if (empty($_POST['redirect'])) {
                 Flash::set('<div class="sub_menu_extension"><strong>Your entry was added succefully! You can edit it below.</strong></div>');
                 Core_Helpers::redirect('/admin/edit/' . Router::uri(3) . '/' . $scaffolder->current_id . '/');
             } else {
                 Flash::set('<div class="sub_menu_extension"><strong>Your entry was added succefully!</strong></div>');
                 Core_Helpers::redirect($_POST['redirect']);
             }
         }
     }
     $this->load_template('edit');
 }