/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new User(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['User'])) { $model->attributes = $_POST['User']; $model->password = getHash($model->password); if (Yii::app()->user->isFranchiseAdmin()) { $model->franchise = Yii::app()->user->franchise; $model->role_id = 2; } if (Yii::app()->user->isAdmin()) { $franchise = new Franchise(); $franchise->name = $model->username; $franchise->save(); $model->franchise = $franchise->id; $model->role_id = 3; } if ($model->save()) { // $this->redirect(array('view', 'id' => $model->id)); $this->redirect(array('user/admin')); } } $this->render('create', array('model' => $model)); }
public function actionFranchise() { $id = $_POST['id']; $franchise = Franchise::model()->findByPk($id); if (!$franchise) { echo "No data found"; Yii::app()->end; } $return = array(); $return['total'] = $franchise->countTotal; $return['customer'] = $franchise->countCustomer; $return['prospect'] = $franchise->countProspect; $return['lost'] = $franchise->countLost; $this->_sendResponse(200, CJSON::encode($return)); }
<?php // Controller for main page include 'vendor/autoload.php'; include 'db_config.php'; // Grab all our models include './models/injuries.php'; include './models/franchises.php'; include './models/games.php'; // Collect data $franchiseModel = new Franchise($db); $injuryModel = new Injury($db); $gameModel = new Game($db); $maxWeek = $gameModel->getMaxWeek(); $injuries = $injuryModel->getAll($maxWeek); $franchises = $franchiseModel->getAll(); // Display template include './templates/injury_management.php';
<td><div class="roundcont"> <div class="roundtop"> <img class="corner" src="images/bl_01.gif" alt="edge" style=" display: none;" /></div> <h1>Franchises for Sale</h1> <div class="roundbottom"> <img src="images/bl_06.gif" alt="edge" class="corner" style=" display: none;" /></div> </div></td> </tr> </table> <p style = "margin-left:10px;">Selling a trading franchise is a discreet business both for the franchisee and franchisor. Advertising in this section requires no pre-set information, it is designed to protect your business and privacy.<br /><br /> An advert could be as simple as; 'Pizza franchise for sale, Essex. Trading 3 years. Contact Fred on 123456789'<br /><br /> Or, you can add your logo and 25 words of text.<br /></p> <table id="table"> <?php $franchise = new Franchise(); $results = $franchise->GetList(array(array("franchise_status", "=", "active"))); shuffle($results); $rowCount = 0; echo "<TR>"; foreach ($results as $obj) { echo "<TD valign=\"top\" width = \"135\">"; echo "<table id=\"table_inner\">"; echo "<TR><TD class=\"cell_logo\">"; echo "<a href=\"" . $obj->link . "\">"; echo "<img src=\"logos/" . $obj->logo . "\" width=\"{$logoWidth}\" height=\"{$logoHeight}\" border=0>"; echo "</a>"; echo "</td></tr>"; echo "<TR><TD class=\"cell_heading\"><a class = 'news' href=\"" . $obj->link . "\">" . $obj->name . "</a></td></tr>"; echo "<TR><TD class=\"cell_description\">" . $obj->description . "</td></tr>"; echo "<TR><TD class=\"cell_tel\">" . $obj->tel . "</td></tr>";
<?php require_once 'templates/draft/header.php'; require_once 'db_config.php'; require_once 'transaction_log.php'; require_once 'models/rosters.php'; require_once 'models/franchises.php'; $task = "list"; $roster = new Roster($db); $franchise = new Franchise($db); define(YEAR, "16"); if (isset($_GET['task'])) { $task = $_GET['task']; } if (isset($_POST['task'])) { $task = $_POST['task']; } if ($task == "draft") { $id = 0; $round = array("1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th", "17th", "18th", "19th", "20th"); $team_list = $franchise->getAll(); if (isset($_GET['id'])) { $id = (int) $_GET['id']; } if ($id != 0) { $details = $roster->getById($id); $tig_name = $details['tig_name']; // Now, we can display the form to let them assign the player to a team require 'templates/draft/form.php'; } else { print "Invalid player ID<br>";
} ?> <div class="form-group"> <?php echo $form->textField($model, 'contact', array('size' => 60, 'maxlength' => 255, 'class' => "form-control textfield", 'placeholder' => 'Jaspers Attendee', 'value' => $curUser->name ? ucfirst($curUser->name) : '')); ?> <?php echo $form->error($model, 'contact'); ?> </div> <?php if (!Yii::app()->user->isUser()) { ?> <!-- <div class="form-group"> <?php echo $form->dropDownList($model, 'franchise', Franchise::getFranchise(), array('empty' => 'Select'), array('options' => array($model->franchise => array('selected' => true)))); ?> <?php echo $form->error($model, 'franchise'); ?> </div>--> <?php } ?> </div> </div> <div class="col-lg-12"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Start' : 'Submit', array('class' => 'btn btn-primary btl top15 pull-right')); ?>
public static function getFranchise() { $model = Franchise::model()->findAll(); return CHtml::listData($model, 'id', 'name'); }
public static function syncFranchise($url) { $franchises = self::getData($url); foreach ($franchises as $franchise) { $fran = Franchise::model()->findByPk($franchise->id); if (!$fran) { $fran = new Franchise(); } $fran->id = $franchise->id; $fran->name = $franchise->d_city ? $franchise->d_city : $franchise->username; $fran->pid = $franchise->pid; mErrors($fran, 0); if ($fran->save()) { self::syncFranchiseUser($franchise); } } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Franchise the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Franchise::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }