Beispiel #1
0
 /**
  * Start the generation process.
  *
  * @return void
  */
 public function __construct($args)
 {
     parent::__construct($args);
     // we need a controller name
     if ($this->lower == null) {
         Common::error('You must specify a bundle name.');
     }
     // add the directory copy to the writer
     $this->writer->copy_directory('Bundle', $this->lower, Bundle::path('bob') . 'templates/bundle', path('bundle') . $this->lower);
     $this->writer->write();
 }
Beispiel #2
0
 /**
  * Start the generation process.
  *
  * @return void
  */
 public function __construct($args)
 {
     parent::__construct($args);
     // we need a task name
     if ($this->class == null) {
         Common::error('You must specify a task name.');
     }
     // set switches
     $this->_settings();
     // start the generation
     $this->_task_generation();
     // write filesystem changes
     $this->writer->write();
 }
Beispiel #3
0
 /**
  * Start the generation process.
  *
  * @return void
  */
 public function __construct($args)
 {
     parent::__construct($args);
     // we need a controller name
     if ($this->class == null) {
         Common::error('You must specify a model name.');
     }
     // load any command line switches
     $this->_settings();
     // start the generation
     $this->_model_generation();
     // write filesystem changes
     $this->writer->write();
 }
Beispiel #4
0
                <?php 
include_once 'header.php';
?>

                <!-- page content -->
                <div class="content-wrap">
                    <div class="content-left">
                        <?php 
include_once 'nav-airport.php';
?>
                    </div>
                    <div class="content-right">
                        <?php 
if (!$airport->exists()) {
    Common::error("Error: Airport could not be found!");
}
?>

          <section class="airport-reviews">
            <?php 
$data = new reviewsFormation();
$exisitng = true;
$reviewsEntries = $data->joinTables();
echo '<h2>Reviews for ' . $airport->name() . '</h2><br>';
if (isset($_SESSION["username"])) {
    echo '<p><a href="title_content_uploader.php"><span style="font-weight:bold">Submit a new Review for ' . $airport->name() . '</span></a></p><br>';
    echo '<p><a href="protected_page.php"><span style="font-weight:bold">Go to My Reviews</span></a></p><br>';
}
if (count($reviewsEntries) != 0) {
    foreach ($reviewsEntries as $blog) {
Beispiel #5
0
                echo "<td>" . $flight->arrival_time() . "</td>";
                echo "<td>" . $flight->status() . "</td>";
                echo "<td> <a href='flightsAdmin.php?step=editFlight&flight_number=" . urlencode($flight->flight_number()) . "'>EDIT</a> <a href='flightsAdmin.php?step=deleteFlight&flight_number=" . urlencode($flight->flight_number()) . "'>DELETE</a></td>";
                echo "</tr>";
            }
        } else {
            echo "<tr><td colspan='7'><center>There aren't any flights at this time.</center></td></tr> ";
        }
        ?>
            </table>
            <br>
            <br>
            <div style="text-align: right" ><a href="flightsAdmin.php?step=createFlight">+ Add New</a></div>
<?php 
    }
} else {
    Common::error("You're not allowed to access this page!");
}
?>

            </div>
    </div>

    <?php 
include_once 'footer.php';
?>

        </div>
</body>
</html>
Beispiel #6
0
 /**
  * Determine class names, identifiers and arguments based on the args
  * passed by the build script.
  *
  * @param array Arguments to the build script.
  * @return void
  */
 public function __construct($args)
 {
     // we need a writer object for file system changes
     $this->writer = new Writer();
     // set default args
     $this->args = $args;
     // if we got an argument
     if (isset($args[0])) {
         // check to see if its bundle prefixed
         if (strstr($args[0], '::')) {
             $parts = explode('::', $args[0]);
             // if we have a bundle and a class
             if (count($parts) == 2 && $parts[0] !== '') {
                 $this->bundle = Str::lower($parts[0]);
                 if (!Bundle::exists($this->bundle)) {
                     Common::error('The specified bundle does not exist, or is not loaded.');
                 }
                 // remove the bundle section, we are done with that
                 $args[0] = $parts[1];
             }
         } else {
             // use the application folder if no bundle
             $this->bundle = DEFAULT_BUNDLE;
         }
         // set bundle path from bundle name
         $this->bundle_path = Bundle::path($this->bundle);
         // if we have a multi-level path
         if (strstr($args[0], '.')) {
             $parts = explode('.', $args[0]);
             // form the class prefix as in Folder_Folder_Folder_
             $this->class_prefix = Str::classify(implode('_', array_slice($parts, 0, -1)) . '_');
             // form the path to the class
             $this->class_path = Str::lower(implode('/', array_slice($parts, 0, -1)) . '/');
             // unaltered case class
             $this->standard = $parts[count($parts) - 1];
             // lowercase class
             $this->lower = Str::lower($parts[count($parts) - 1]);
             // get our class name
             $this->class = Str::classify($parts[count($parts) - 1]);
         } else {
             // unaltered case class
             $this->standard = $args[0];
             // lowercase class
             $this->lower = Str::lower($args[0]);
             // get our class name
             $this->class = Str::classify($args[0]);
         }
     }
     // pass remaining arguments
     $this->arguments = array_slice($args, 1);
 }
Beispiel #7
0
 /**
  * Copy a directory of templates to a destination.
  *
  * <code>
  * $this->_dircopy[] = array(
  * 		'type' 			=> 'View',
  *   	'name' 			=> 'Descriptive identifier shown to terminal.',
  *    	'source' 		=> 'the/location/to/copy/from',
  *     	'destination' 	=> 'the/location/to/copy/to'
  * );
  * </code>
  *
  * @return void
  */
 private function _copy_dirs()
 {
     // loop through dirs to copy
     foreach ($this->_dircopy as $dir) {
         // if force is set we overwrite anyway
         if (!is_dir($dir['destination']) and Common::config('force') == false) {
             if (!Common::config('pretend')) {
                 File::cpdir($dir['source'], $dir['destination']);
             }
             // log something pretty to the terminal
             Common::log("{c}({g}~{c}) {y}{$dir['type']}\t\t{w}{$dir['name']}");
         } else {
             // we cant copy if its already there
             Common::error('The directory \'' . $dir['name'] . '\' already exists.');
         }
     }
 }
Beispiel #8
0
 private function getAirport($id)
 {
     $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT);
     $stmt = $this->db->send_sql("SELECT * FROM airports WHERE id='{$id}'");
     if ($stmt->num_rows > 0) {
         //AIRPORT EXISTS
         //fetch info from the db
         $info = $stmt->fetch_array(MYSQLI_ASSOC);
         //populate class with contents
         $this->id = $info['id'];
         $this->name = $info['name'];
         $this->history = $info['history'];
         $this->parking = $info['parking'];
         $this->faq = $info['faq'];
         $this->contact = $info['contact'];
         $stmt->close();
     } else {
         //AIRPORT NOT FOUND
         Common::error("Error: Airport could not be found!");
     }
 }