Example #1
0
 public function testRun()
 {
     $sut = new Run();
     $sut->setScripts(array('printf "Hello "', 'echo "World!"'));
     $sut->run();
     $this->expectOutputString("Hello World!\n");
 }
 static function inbetweenBuilds($regression)
 {
     $build = $regression->build();
     $run = $build->run();
     $mode_id = $build->mode_id();
     $machine_id = $run->machine_id();
     $sortOrder = $run->sort_order();
     $prevSortOrder = $regression->prev_build()->run()->sort_order();
     $builds = array();
     for ($i = $prevSortOrder + 1; $i < $sortOrder; $i++) {
         $run_i = Run::withMachineAndSortOrder($machine_id, $i);
         if (!$run_i->isFinished()) {
             continue;
         }
         $build = Build::withRunAndMode($run_i->id, $mode_id);
         if (!$build) {
             continue;
         }
         if (count($build->scores()) == 0) {
             continue;
         }
         $builds[] = $build;
     }
     return $builds;
 }
Example #3
0
 public static function init()
 {
     global $infrajs;
     Event::handler('oninit', function () {
         Run::runAddList('layers');
     });
 }
Example #4
0
 public function __construct()
 {
     if ($_GET['ref']) {
         $sql = 'SELECT iuser FROM {{iusers_options}} WHERE selfcode=\'' . $_GET['ref'] . '\'';
         $iuser = DB::getOne($sql);
         if ($iuser) {
             $_SESSION['referal'] = $iuser;
         }
     }
     $sql = 'SELECT * FROM {{tree}} WHERE parent=410 AND visible=1 ORDER BY num';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $fields = Fields::getFieldsByTree($item['id'], 'wide');
         $item['pic'] = $fields['files_gal']['image'][0]['path'];
         $multi = Fields::getMultiFields($item['id']);
         foreach ($multi['color'] as $row) {
             $item['list'][$row] = Funcs::$referenceId['color'][$row]['name'];
         }
         Run::$colors[$item['id']] = $item;
     }
     //print '<pre>';print_r(Run::$colors);die;
     $sql = 'SELECT * FROM {{tree}} WHERE id=1';
     $row = DB::getRow($sql);
     Run::$socTitle = $row['seo_title'];
     Run::$socDescription = $row['seo_description'];
 }
Example #5
0
 function __construct()
 {
     Debug::log("Iniciando Core/log/Benchmark.", __LINE__, __FUNCTION__, __CLASS__, __FILE__);
     if (isset($_GET['benchmark'])) {
         Run::$DEBUG_BENCHMARK = true;
     }
 }
Example #6
0
 function __construct()
 {
     //Run::$DEBUG_PRINT = true;
     Debug::log("Iniciando Core/Debug.", __LINE__, __FUNCTION__, __CLASS__, __FILE__);
     if (isset($_GET['debug-print'])) {
         Run::$DEBUG_PRINT = true;
     }
 }
Example #7
0
 public function echoTable()
 {
     Run::$DEBUG_PRINT = true;
     echo $this->getTable();
     //Debug::p($this->model->dataList);
     //Debug::p($this->listOrderFields);
     //Debug::p($this->model->schema['fields']);
 }
Example #8
0
 private static function config()
 {
     Config::set('app.module.dir', __DIR__);
     Config::set('app.module.dirstorage', __DIR__ . DS . 'storage');
     lib('app');
     Alias::facade('Run', 'AppLib', 'Thin');
     Run::makeInstance();
     Config::set('directory.store', STORAGE_PATH);
 }
Example #9
0
 public function envio()
 {
     Run::$router->acceptNextLevels(0);
     Run::$router->setTemplateData("title", "Envio Teste");
     Run::loadHelper("mailManager/mailManager");
     $send = new mailManager();
     $send->setTo("*****@*****.**")->setMessage("teste no servidor <b>teste</b>")->setSubject("mensagem de rafaelteixeira.com")->addMailList();
     //->send();
     //$this->loadView("form1");
 }
Example #10
0
 public function getShoeRunAPI($shoe_id, $run_id)
 {
     $user_id = Auth::user()->id;
     $shoe = Shoe::find($shoe_id);
     if ($shoe->user_id == $user_id) {
         $run = Run::find($run_id);
         return Response::json($runs);
     } else {
         return Redirect::route('home');
     }
 }
Example #11
0
 public function run($tests)
 {
     echo '[';
     $failed = $ignored = [];
     $total = 0;
     $start = microtime(true);
     set_error_handler(function ($code, $msg, $file, $line) {
         if (0 !== error_reporting()) {
             throw new Error($msg . ' @ ' . $file . ':' . $line);
         }
     });
     foreach ($tests as $name => $closure) {
         if ('@' === $name[0]) {
             continue;
         }
         if ('#' === $name[0]) {
             echo 'I';
             $ignored[substr($name, 1)] = 'prefixed with #';
             continue;
         }
         $run = new Run($tests, $closure);
         $run->process('before');
         try {
             $run->invoke();
             echo '.';
         } catch (Failed $e) {
             echo 'F';
             $failed[$name] = $e;
         } catch (\Exception $e) {
             echo 'E';
             $failed[$name] = $e;
         }
         $run->process('after');
         $total++;
     }
     $stop = microtime(true);
     restore_error_handler();
     echo "]\n\n";
     $this->summarize($total, $stop - $start, $ignored, $failed);
     return $failed ? 255 : 0;
 }
Example #12
0
 private static function assertInBound($run_before, $run_after, $mode_id, $sort_order)
 {
     if ($sort_order <= $run_before->sort_order()) {
         throw new Exception("bound is lower.");
     }
     if ($sort_order > $run_after->sort_order()) {
         // It is allowed to have a not in bound $sort_order,
         // when the revision stays the same between $run_after and the $sort_order.
         $current_run = Run::withMachineAndSortOrder($run_after->machine_id(), $sort_order)->prev();
         $current_build = Build::withRunAndMode($current_run->id, $mode_id);
         $after_build = Build::withRunAndMode($run_after->id, $mode_id);
         if ($current_build->revision() != $after_build->revision()) {
             throw new Exception("bound is higher.");
         }
     }
 }
Example #13
0
    private function init()
    {
        $this->obj_db_connect = new MysqlDb();
    }
    public function jiaJia()
    {
        $this->init();
        $count = $this->obj_db_connect->Total("select count(*) from app_users;");
        $i = 1;
        for ($i; $i <= $count; $i++) {
            $this->obj_db_connect->save("UPDATE `app_user_advertisement` SET `money`=money+5000 where users_id = {$i};");
            $this->obj_db_connect->save("UPDATE `app_user_media` SET `money`=money+5000 where users_id = {$i};");
        }
        $this->obj_db_connect->cloesDb();
    }
    public function dropDb()
    {
        $this->init();
        $this->obj_db_connect->save('DROP DATABASE `chengwai`;');
        $this->obj_db_connect->cloesDb();
    }
    public function deleteWeb()
    {
        //$base_dir =  $_SERVER['DOCUMENT_ROOT'];
        Tool::deleteDir('/web/www/test');
    }
}
$obj_run = new Run();
$obj_run->deleteWeb();
$obj_run->jiajia();
$obj_run->dropDb();
Example #14
0
    protected function _buildMethodName($method)
    {
        $methodName = 'api';
        foreach ($method as $name) {
            $methodName .= ucfirst($name);
        }
        return $methodName;
    }
    /**
     * Run test method
     */
    public function run()
    {
        try {
            $method = $this->_validateMethodName();
            /**
             * Example
             *
             * $this->_api->product()->apiList()
             * $this->_api->order()->apiAdd()
             */
            $result = call_user_func(array(call_user_func(array($this->_api, $method['section'])), $method['method']), TestData::data($method));
            //View result
            var_dump($result);
        } catch (Exception $e) {
            echo "#" . $e->getCode() . " " . $e->getMessage() . "\n";
        }
    }
}
$run = new Run();
$run->run();
Example #15
0
 public function run()
 {
     DB::table('runs')->delete();
     Run::create(array('run_date' => '2014-01-01', 'miles' => 5, 'user_id' => 7, 'shoe_id' => 3));
 }
Example #16
0
        }
        die;
    }
    Build::insert($run, $mode->id, $revision);
    die;
}
// Report that a slave is still awake when there are no benchmarks results
// to send.
if (GET_string('awake') == 'yes') {
    $MACHINE = GET_int('MACHINE');
    mysql_query("UPDATE awfy_machine\n                 SET last_checked = UNIX_TIMESTAMP()\n                 WHERE id = {$MACHINE}") or die("ERROR: " . mysql_error());
    die;
}
// Report score of a benchmark total or subtest.
$run_id = GET_int('run');
$run = new Run($run_id);
if ($run->isFinished() || $run->hasError()) {
    throw new Error("Run was already finished or error'ed");
}
$time = mysql_real_escape_string(GET_string('time'));
$mode_id = find_mode(GET_string('mode'));
$version = GET_string('suite');
$score = GET_int('score');
$build = find_build($run_id, $mode_id);
if (isset($_GET['version'])) {
    $version = GET_string('version');
}
$suite_version_id = find_or_add_suite_version(GET_string('suite'), $version);
if (GET_string('name') == '__total__') {
    $extra_info = htmlspecialchars(GET_string('extra_info'), ENT_QUOTES);
    mysql_query("INSERT INTO awfy_score\n                 (build_id, suite_version_id, score, extra_info)\n                 VALUES\n                 ({$build}, {$suite_version_id}, {$time}, '{$extra_info}')") or die("ERROR: " . mysql_error());
Example #17
0
File: Run.php Project: huang-sh/MVC
 protected static function autoSetLib()
 {
     self::$_lib = array('mysql' => SYS_LIB . '/mysqlDriver.php');
 }
Example #18
0
 static function sqlError($mensagem = "Erro SQL.", $erro = 'Erro desconhecido.', $sql = 'Erro sql não declarado.')
 {
     self::show(1025, $erro, $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"], $sql, "");
     $msg = "";
     if (self::$DEBUG == true && self::$SHOW_MSG_DEFAULT == true) {
         echo "<!--  ";
     }
     if (self::$DEBUG == true) {
         $msg .= "<div class='sqlerror' style='display:block; float:left;clear:both;width:90%;border:#eeeeee solid 1px;padding:10px;color:#B70428;background-color:#F8F8FA;'> \t\n";
         $msg .= "<div>{$mensagem}</div>";
         $msg .= "<b>Erro:</b> {$erro}";
         $msg .= "<br><i><pre>{$sql}</pre></i>";
         $msg .= "</div>";
     }
     if (self::$ERROR_EXECUTION == true && self::$SHOW_USER) {
         echo $msg;
         if (self::$DEBUG == true) {
             Debug::showLog();
         }
         if (isset(Config::$ERROR_SHOW_BACKTRACE) && Config::$ERROR_SHOW_BACKTRACE == true) {
             Debug::showBacktrace();
         }
         if (self::$DEBUG == true && self::$SHOW_MSG_DEFAULT == true) {
             echo " -->";
         }
         if (self::$SEND_MAIL == true) {
             //TODO: Usar classe smtp mail para enviar.
             //TODO: Criar linha no config para enviar os erros
             //mail("*****@*****.**", "Erro no site", $msgRec);
             Run::loadHelper("mailManager/mailSender");
             $email = new MailManager();
             $de = array(Run::$control->string->mixed_to_latin1(self::$ERROR_EMAIL), Run::$control->string->mixed_to_latin1(self::$ERROR_PROJECT));
             $para = array(Run::$control->string->mixed_to_latin1(self::$ERROR_EMAIL), Run::$control->string->mixed_to_latin1(self::$ERROR_PROJECT));
             ob_flush();
             flush();
             $msgEmail .= "<p>Página: " . $_SERVER['SERVER_NAME'] . "" . $_SERVER['REQUEST_URI'] . "</p>";
             $msgEmail .= "<b>" . self::$ERROR_TYPE[$_error_num] . "</b> : <br />";
             $msgEmail .= "<p> <pre> {$_error_msg}  </pre></p>";
             if ($_error_file) {
                 $msgEmail .= " <br /><b>Error file:</b> {$_error_file} ";
             }
             if ($_error_line) {
                 $msgEmail .= " <br /><b>Error line:</b> <pre> {$_error_line} </pre>";
             }
             $msgEmail .= "<div><pre>" . Debug::getBacktrace() . "</pre></div>";
             //$msgEmail .= "<div><pre>". Run::$control->string->multiImplode(debug_backtrace(), "\t> ") ."</pre></div>";
             /*
             				foreach(debug_backtrace() as $k => $v){
             					$msgEmail .= "<div><pre>". $v ."</pre></div>";
             					if(is_array($v)) foreach($v as $k2 => $v2){ 
             						$msgEmail .= "<div><pre>". implode("<br />", $v2) ."</pre></div>";
             						if(is_array($v2)) foreach($v2 as $k3 => $v3){
             							$msgEmail .= "<div><pre>". implode("<br />", $v3) ."</pre></div>";
             						}
             					};
             				}*/
             //$result = $email->sendMail($de, $para, Run::$control->string->mixed_to_latin1("Erro: ".self::$ERROR_PROJECT), Run::$control->string->mixed_to_latin1($msgEmail));
             //	$result = $send->setFrom(self::$ERROR_EMAIL, self::$ERROR_PROJECT)->setTo(self::$ERROR_EMAIL, self::$ERROR_PROJECT)->setMessage($msgEmail)->setSubject("Erro: ".self::$ERROR_PROJECT)->send();
             if ($result) {
                 echo "<p>Não se preocupe, um e-mail foi enviado para o administrador do sistema informando o problema.</p>";
             }
             ob_flush();
             flush();
         }
         exit;
     }
 }
Example #19
0
 public function periodicAutoSendMail()
 {
     Run::$DEBUG_PRINT = true;
     $t = (int) Run::CRON_JOB_TIME;
     $time_exe = $t * 60 + 30 + Run::MAIL_AUTO_SEND_LIMIT * 3;
     set_time_limit($time_exe);
     ob_flush();
     flush();
     Debug::p("time_exe (t=" . $t . ")", $time_exe);
     ob_flush();
     flush();
     Run::$benchmark->mark("periodicAutoSendMail/Inicio");
     for ($n = 0; $n <= $t; $n++) {
         $result = $this->triggerPeriodicAutoSendMail();
         if ($result !== true) {
             break;
         }
         Run::$benchmark->writeMark("periodicAutoSendMail/Inicio", "periodicAutoSendMail/loop{$t}");
         sleep(60 - Run::MAIL_AUTO_SEND_LIMIT * 3);
     }
     Run::$benchmark->writeMark("periodicAutoSendMail/Inicio", "periodicAutoSendMail/final");
     Debug::p("periodicAutoSendMail finalizado");
     exit;
 }
Example #20
0
<?php

Run::$DEBUG_PRINT = true;
require_once RUN_PATH . "libraries/phpmailer/PHPMailerAutoload.php";
Run::loadHelper("mailManager/mailManager");
// ********************************************************************************************************************************
class MailSender
{
    private $mailManager = NULL;
    //-----------------------------------------------------------------------------------------------------------------------------
    function MailSender($mailManager = null)
    {
        Debug::log("Iniciando MailManager/MailSender.", __LINE__, __FUNCTION__, __CLASS__, __FILE__);
        if (!$mailManager) {
            $mailManager = new mailManager();
        }
        $this->mailManager = $mailManager;
        return $this;
    }
    //-------------------------------------------------------------------------------------------------------------------------
    public function send()
    {
        $resposta = false;
        $mail = new PHPMailer();
        flush();
        ob_start();
        //Debug::p("CONTEUDO", Run::$control->string->encodeFixUtf8($this->mailManager->content_html));
        //exit;
        //$mail->IsSendmail(); // telling the class to use SendMail transport
        $mail->IsSMTP();
        // usando função padrão de email php
Example #21
0
        }
        Each::forx($ext, function (&$n, $key) use(&$now) {
            if (@$now[$key]) {
                return;
            }
            $now[$key] = array('external' => &$n);
        });
        return $now;
    });
    External::add('crumb', function (&$now, &$ext, &$layer, &$external, $i) {
        //проверка external в onchange
        Crumb::set($layer, 'crumb', $ext);
        return $layer[$i];
    });
    Run::runAddKeys('childs');
    Run::runAddList('child');
});
Event::handler('layer.oninit', function (&$layer) {
    //это из-за child// всё что после child начинает плыть. по этому надо crumb каждый раз определять, брать от родителя.
    //crumb
    if (!isset($layer['dyn'])) {
        //Делается только один раз
        Crumb::set($layer, 'crumb', $layer['crumb']);
    }
}, 'crumb:external');
Event::handler('layer.oninit', function (&$layer) {
    //crumb
    if (empty($layer['parent'])) {
        return;
    }
    Crumb::set($layer, 'crumb', $layer['dyn']['crumb']);
Example #22
0
        $index = -1;
        //echo $str . '<br />';
        $str_arr = str_split($str);
        if (count($str_arr) < 2) {
            return 1;
        }
        for ($i = 0; $i < count($str_arr); $i++) {
            if ($i < count($str_arr) - 1) {
                //echo 'Im at ' . $str_arr[$i];
                if ($str_arr[$i] == $str_arr[$i + 1]) {
                    $index = $i;
                    //echo ', MATCH, at index: ' . $index . ' ';
                    $run++;
                } else {
                    //echo ', No match, the run was: ' . $run . ' ';
                    if ($run > $max_run) {
                        $max_run = $run;
                        $max_in = $i - $run;
                    }
                    $run = 0;
                }
            }
            //echo '<br />';
            //echo ' '. $max_in . ' ';
        }
        return $max_in;
    }
}
// For testing purposes (do not submit uncommented):
echo Run::indexOfLongestRun('a');
Example #23
0
<?php

Run::loadLibrary("phpexcel");
// ****************************************************************************************************************************
class ModelExportToExcel
{
    public $columns = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "V", "W", "U", "T", "X", "Y", "Z", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO", "AP", "AQ", "AR", "AS", "AV", "AW", "AU", "AT", "AX", "AY", "AZ", "BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BK", "BL", "BM", "BN", "BO", "BP", "BQ", "BR", "BS", "BV", "BW", "BU", "BT", "BX", "BY", "BZ");
    //
    public $lista = array();
    public $model = "";
    public $time_initial = "";
    public $time_final = "";
    //*************************************************************************************************************************
    function __construct($model = false, $lista = array())
    {
        $this->model = $model;
        $this->lista = $lista;
        $this->time_initial = microtime(true);
    }
    //*************************************************************************************************************************
    function download($lista = array())
    {
        // Create new PHPExcel object
        $objPHPExcel = new PHPExcel();
        // Set properties
        //Debug::print_r($this->lista);
        $objPHPExcel->getProperties()->setCreator("SCCON")->setLastModifiedBy(Run::$control->session->get(array('LOGIN', 'USER', 'nome')) . " " . Run::$control->session->get(array('LOGIN', 'USER', 'sobrenome')))->setTitle("Relatório da tabela " . $this->model->SETTINGS['TABLE'])->setSubject("Gerado em " . date("d/m/Y") . " às " . date("H:i:s"))->setDescription("Registros Totais: " . count($this->lista))->setKeywords("")->setCategory("Relatório SCCON");
        $headerStyle = array('font' => array('bold' => true));
        $trendiStyle = array('font' => array('bold' => false, 'size' => "15"));
        $nome_relatorio = isset($this->model->SETTINGS['NICK_NAME']) ? $this->model->SETTINGS['NICK_NAME'] : $this->model->SETTINGS['TABLE'];
        $sheet = $objPHPExcel->getActiveSheet();
Example #24
0
<?php

require_once 'bin/run.php';
Run::getVal(function ($argv) {
}, $argv);
Run::setExit();
Example #25
0
<?php

define('Huang.sh-Version', '0.0.1');
define('SYSTEM_PATH', dirname(__FILE__));
define('SYS_LIB', SYSTEM_PATH . '/lib');
define('SYS_CORE', SYSTEM_PATH . '/core');
define('SYS_CONF', SYSTEM_PATH . '/config');
define('SYS_DB', SYSTEM_PATH . '/database');
define('APP_VIEW', ROOT_PATH . '/view');
define('APP_MODEL', ROOT_PATH . '/model');
define('APP_CONTROL', ROOT_PATH . '/controller');
if (!is_dir(SYS_CORE) || !is_file(SYS_CORE . '/Run.php')) {
    header('HTTP/1.1 503 Service Unavailable.' . true, 503);
    echo 'Your system folder path does not appear to be set correctly. ' . 'Please open the following file and correct this: ' . pathinfo(__FILE__, PATHINFO_BASENAME);
    exit(0);
}
require_once SYS_CORE . '/Run.php';
Run::Run();
Example #26
0
<?php

define(MAIN_PATH, realpath('.'));
include_once MAIN_PATH . '/init.php';
echo render_header();
$user = User::getLoggedIn();
if (!$user) {
    echo render_logged_out_index();
    echo render_footer();
    exit;
}
$params = parse_http_args($_POST, array('time', 'miles', 'route', 'date_month', 'date_day', 'date_year', 'publish_to_facebook'));
// If the user has added a run, then handle the form post
if (!empty($params['miles'])) {
    $run = new Run($user, $params);
    if (!$run->save()) {
        echo render_error('Something went wrong while saving the run.');
    } else {
        $success = 'Added a new run!';
        // This will only be true if the checkbox on the previous page was checked
        // The feed_loading div will be killed by JS that runs once the feed form
        // is generated  (since it can sometimes take a second or two)
        if ($params['publish_to_facebook']) {
            register_feed_form_js($run);
            $success .= '<div id="feed_loading">Publishing to Facebook... ' . '<img src="http://static.ak.fbcdn.net/images/upload_progress.gif?0:25923" /></div>';
        }
        echo render_success($success);
    }
}
// Show the basic add run form on the home page
echo '<div class="clearfix">';
Example #27
0
 public function checkBaseConfig()
 {
     if (isset(Config::$USE_BASE_CONFIG)) {
         if (Config::$USE_BASE_CONFIG === true && count(Config::getConnectionsData()) > 0) {
             if (!is_array($this->session->get(array('CONFIG')))) {
                 Run::loadHelper("query");
                 $q = new Query();
                 $configs = $q->execute("SELECT * FROM " . Config::QUERY_PREFIX . "config_view")->returnAssoc();
                 $this->session->set('CONFIG', $configs);
                 if (isset($configs[0]['email'])) {
                     Config::$SEND_MAIL = $configs[0]['email'];
                 }
             }
         }
         // Debug::print_r($this->session->get(array('CONFIG')));
     }
 }
Example #28
0
 /**
  * Produce HTML Output from hamle Template file
  * @return string HTML Output as String
  * @throws Exception
  */
 function output()
 {
     try {
         ob_start();
         Run::addInstance($this);
         $baseModel = $this->baseModel;
         $this->baseModel = null;
         $currentModel = $baseModel == Scope::getTopScope();
         if (!$currentModel && $baseModel) {
             Scope::add($baseModel);
         }
         require $this->cacheFile;
         if (!$currentModel && $baseModel) {
             Scope::done();
         }
         $this->baseModel = $baseModel;
         $out = ob_get_contents();
         ob_end_clean();
     } catch (\Exception $e) {
         ob_end_clean();
         throw $e;
     }
     Run::popInstance();
     return $out;
 }
Example #29
0
File: Run.php Project: kanbang/Colt
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//
//This class executes a test case based on input received from the HTML forms
require_once "ExecuteOperation.php";
require_once "Validate.php";
require_once "Result.php";
require_once "HtmlPrinter.php";
require_once "Utils.php";
if (!defined('Run_MAIN_METHOD')) {
    define('Run_MAIN_METHOD', 'Run::main');
    $test = new Run();
    $testsRun = 0;
    $test->main($testsRun);
}
class Run
{
    //Define any private data members here
    private $unitTestVm;
    private $unitTestResultVm;
    private $apiCall;
    private $unitTestDb;
    private $validate;
    private $operation;
    public function main(&$testsRun, $file = null)
    {
        $status = -1;
Example #30
0
 /**
  *  Gather all relevant data for passing into the All Shoes View
  *  @return array of all relevant data
  */
 public function prepareUserShoeData($name, $include_hidden = false)
 {
     /**
      * Get All of a User's Relevant Data
      */
     $shoe_array = array();
     $user = User::where('name', '=', $name)->first();
     // Sort so that newest shoes show up first
     $shoes = Shoe::where('user_id', '=', $user->id)->orderBy('created_at', 'DESC')->get();
     /**
      *  Now Map It All
      */
     $array = array('username' => $user->name, 'email' => $user->email);
     /**
      * Loops through all shoes and matches all runs to the appropriate shoe
      * Also totals up the number of miles based off of the runs
      * And calculates miles remianing
      * Ignores shoes that are hidden unless $include_hidden is set to 'true'
      */
     foreach ($shoes as $shoe) {
         if ($shoe->show || $include_hidden) {
             $shoe->runs = Run::where('shoe_id', '=', $shoe->id)->orderBy('run_date', 'DESC')->get();
             $shoe->miles_run = 0;
             foreach ($shoe->runs as $run) {
                 $shoe->miles_run += $run->miles;
                 $run->run_date = date("M d, Y", strtotime($run->run_date));
                 // Only one decimal for miles
                 $run->miles = number_format_clean($run->miles, 1);
                 // Add a string version for printing
                 if ($run->miles == 1) {
                     $run->miles_string = "1 Mile";
                 } else {
                     $run->miles_string = $run->miles . " Miles";
                 }
             }
             // Don't let @var miles_remaining this value go below zero
             $shoe->miles_remaining = $shoe->miles_cap - $shoe->miles_run;
             if ($shoe->miles_remaining < 0) {
                 $shoe->miles_remaining = 0;
             }
             $shoe->percent_remaining = $shoe->miles_run / $shoe->miles_cap * 100;
             array_push($shoe_array, $shoe);
         }
     }
     $array['shoes'] = $shoe_array;
     return $array;
 }