本文整理汇总了PHP中Base_Controller::getView方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_Controller::getView方法的具体用法?PHP Base_Controller::getView怎么用?PHP Base_Controller::getView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_Controller
的用法示例。
在下文中一共展示了Base_Controller::getView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_winners
public function action_winners()
{
$model = parent::getModel('Fight', 'Fight');
$utils = new utils();
$winners = $model->GetWinner($utils);
$winnersViewData = $model->CalculateWinner($winners);
if ($winnersViewData) {
parent::setViewVars(array("winnersViewData" => $winnersViewData));
}
parent::setTemplate('SlapChallengeMain');
parent::getView($this->controller, 'Winners');
parent::render();
}
示例2: action_index
public function action_index()
{
try {
$target_dir = "./app_data/";
$target_file = $target_dir . basename($_FILES["contestantsUpload"]["name"]);
if (isset($_POST["submit"])) {
// First check mime type to ensure correct file is being uploaded.
$check = getimagesize($_FILES["contestantsUpload"]["tmp_name"]);
$mimes = array('application/vnd.ms-excel', 'text/plain', 'text/csv', 'text/tsv');
if (in_array($_FILES['contestantsUpload']['type'], $mimes)) {
// Next check size of file to ensure it does not violate limit.
if ($_FILES["contestantsUpload"]["size"] > 500000) {
// NOTE: in a production environment we would not give an error message
// with this much detail based on OWASP recommendations.
throw new Exception('Error, file exceeds maximum file size.');
}
// Next try to save the file to the app_data directory.
if (move_uploaded_file($_FILES["contestantsUpload"]["tmp_name"], $target_file)) {
// do nothing at this time.
} else {
throw new Exception('Error uploading file.');
}
} else {
throw new Exception('Sorry, wrong file type.');
}
}
} catch (Exception $e) {
// Handle Error gracefully.
parent::setViewVars(array("ErrorMessage" => $e->getMessage()));
parent::setTemplate('SlapChallengeMain');
parent::getView("Upload", "Index");
parent::render();
return;
}
// Instantiate model for Upload route.
$model = parent::getModel('Upload', 'Upload');
// Parse and store contents in databse.
if ($model->ParseUpload($_FILES["contestantsUpload"]["name"], $this->utils)) {
parent::setViewVars(array("UploadStatus" => "File has been uploaded successfully! <a class=\"btn btn-primary\" href=\"/Fight/Index\">Let's Fight</a>"));
} else {
parent::setViewVars(array("UploadStatus" => "There has been an issue please <a href=\"/\">Click Here to Try Again</a>."));
}
parent::setTemplate('SlapChallengeMain');
parent::getView("Upload", "Index");
parent::render();
}
示例3: action_index
/**
* Run our request
*
* @param string $url
*/
public function action_index()
{
try {
if (!parent::$router) {
throw new Exception("Router not set");
}
// Get our view
parent::setViewVars(array(
"testVariable" => "set from dispatch",
"innerArray" => array("testing" => "Inner Array", "anotherIndex" => "Testing")
));
parent::setTemplate('SlapChallengeMain');
parent::getView($this->controller, 'Index');
parent::render();
} catch (Exception $e) {
}
}