本文整理汇总了PHP中Setup::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::model方法的具体用法?PHP Setup::model怎么用?PHP Setup::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setup
的用法示例。
在下文中一共展示了Setup::model方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDisableinternet
public function actionDisableinternet($current_url)
{
Setup::model()->disableInternetConnection();
Yii::app()->controller->redirect($current_url);
}
示例2: array
<tr>
<td colspan="2">
<?php
//$send_order_url=Yii::app()->request->baseUrl.'/PurchaseOrder/SendOrder/'.$purchase_id;
//$send_order_url=Yii::app()->request->baseUrl.'/index.php?r=purchaseOrder/SendOrder&id='.$purchase_id;
$send_order_url = $this->createUrl('purchaseOrder/sendOrder', array('id' => $purchase_id));
?>
<?php
$setupModel = Setup::model()->findByPk(1);
$internet_connected = AdvanceSettings::model()->findByAttributes(array('parameter' => 'internet_connected'));
$current_url = Yii::app()->request->url;
if ($internet_connected->value == 1) {
if (Setup::model()->checkInternet()) {
if ($model->order_status < 3) {
?>
<a href="<?php
echo $send_order_url;
?>
" onclick="return confirm('Are you sure?')">
<?php
echo CHtml::button($model->order_status == 1 ? 'Send Order' : 'Resend Order');
?>
</a>
<br>
<small>Ordered will be send via email. Please make sure your mail settings are configured</small>
<?php
} else {
?>
示例3: copyfiles
public function copyfiles()
{
$msg = '';
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
$xml = simplexml_load_file("temp/tempaddonfile/install_addon.xml");
$source_file = getcwd() . DS . "temp" . DS . "tempaddonfile" . DS . $xml->install->source->folder;
$desti_file = getcwd() . DS . $xml->install->destination->folder;
$msg .= "<br>Source file " . $source_file;
$msg .= "<br>Destination file " . $desti_file;
Setup::model()->recurse_copy($source_file, $desti_file);
$source_file = getcwd() . DS . "temp" . DS . "tempaddonfile" . DS . $xml->install->source->js;
$desti_file = getcwd() . DS . $xml->install->destination->js;
$msg .= "<br>Source file " . $source_file;
$msg .= "<br>Destination file " . $desti_file;
Setup::model()->recurse_copy($source_file, $desti_file);
$source_file = getcwd() . DS . "temp" . DS . "tempaddonfile" . DS . $xml->install->source->images;
$desti_file = getcwd() . DS . $xml->install->destination->images;
$msg .= "<br>Source file " . $source_file;
$msg .= "<br>Destination file " . $desti_file;
Setup::model()->recurse_copy($source_file, $desti_file);
}
示例4: updateVersion
public function updateVersion($id)
{
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
$last_successful_step = '';
$last_successful_step_message = '';
$step_info = array();
$setupModel = Setup::model()->findByPk('1');
//echo $setupModel->version_update_url;
$update_url_from_db = $setupModel->version_update_url;
//$request='http://www.rapportsoftware.co.uk/versions_test/latest_callhandling_version.txt';
$request = $update_url_from_db . '/latest_stocksystem_version.txt';
$installed_version = Yii::app()->params['software_version'];
$available_version = $this->curl_file_get_contents($request);
$server_update_filename = $installed_version . "_to_" . $available_version . "_update_ims.zip";
//$server_update_filepath = "http://www.rapportsoftware.co.uk/versions_test/";
$server_update_filepath = $update_url_from_db;
$server_update_full_filepath = $server_update_filepath . DS . $server_update_filename;
$update_directory = 'updates_ims';
$local_desination_server_update_file = $update_directory . DS . $server_update_filename;
/*THESE VARIABLEUES USED IN STEP 5 & 6*/
$unzip_folder = $update_directory . DS . $installed_version . "_to_" . $available_version . "_update_ims";
$setup_file = getcwd() . DS . $unzip_folder . DS . 'setup.json';
/*THE SETUP FILES IS LIKE CONTENTS OF NEW FILES TO BE COPIED*/
switch ($id) {
/*STEP 1*/
/*Downlaoding the update file*/
case 1:
if (!@copy($server_update_full_filepath, $local_desination_server_update_file)) {
$errors = error_get_last();
$last_successful_step_message = "File Download ERROR: " . $errors['type'] . "<br>" . $server_update_full_filepath;
$last_successful_step_message .= "<br />\n" . $errors['message'];
$last_successful_step_message .= "<br /><span style='color:red;'>There was some problem in downloading the file from the server. Please check your internet connection. If Problem still persist, contact support at <a href='mailto:support@rapportsoftware.co.uk'>support@rapportsoftware.co.uk</a><br /></span> ";
$last_successful_step = 0;
} else {
$last_successful_step = 1;
$last_successful_step_message = "Files succesfully downloaded!";
}
$message = $this->createMessage($last_successful_step_message, $last_successful_step);
array_push($step_info, $last_successful_step);
array_push($step_info, $message);
return $step_info;
break;
/*STEP 2*/
/*Creating a backup of database*/
/*STEP 2*/
/*Creating a backup of database*/
case 2:
$db_current_location = getcwd() . DS . 'protected' . DS . 'data' . DS . 'ims.db';
$db_backup_location = $update_directory . DS . 'backup' . DS . 'version_' . $installed_version . '_database';
$db_backup_filename = $db_backup_location . DS . 'ver_' . $installed_version . '.data.db';
if (!file_exists($db_backup_filename)) {
if (!is_dir($db_backup_location)) {
if (!mkdir($db_backup_location, 0777, true)) {
$last_successful_step = 0;
$last_successful_step_message = "Cannot create Directory for Database backup, please check permissions";
die('Failed to create folders...');
break;
}
}
///end of if dir present at backup location
if (!@copy($db_current_location, $db_backup_filename)) {
$errors = error_get_last();
$last_successful_step = 0;
$last_successful_step_message = "<br>Database backup creation error: " . $errors['type'];
$last_successful_step_message .= "<br />\n" . $errors['message'];
$last_successful_step_message .= "<br /><span style='color:red;'>There was some problem in creating backup of database. Make sure all users are logged out of the system. If Problem still persist, contact support at <a href='mailto:support@rapportsoftware.co.uk'>support@rapportsoftware.co.uk</a><br /></span> ";
} else {
$last_successful_step = 2;
$last_successful_step_message = "Database successfully Backuped";
}
///end of else
} else {
$last_successful_step = 2;
$last_successful_step_message = "Database backup skipped because data is already backed up";
}
////end of else of database backup skipped
$message = $this->createMessage($last_successful_step_message, $last_successful_step);
array_push($step_info, $last_successful_step);
array_push($step_info, $message);
return $step_info;
break;
/*STEP 3*/
/*Creating Backup of Files*/
/*STEP 3*/
/*Creating Backup of Files*/
case 3:
/*STEP 3*/
/*Creating Backup of Files*/
/*Creating Backup of Files*/
$source = getcwd() . DS . 'protected';
$dest = $update_directory . DS . 'backup' . DS . 'version_' . $installed_version . '_files' . DS . 'protected';
if (!is_dir($dest)) {
if (!is_dir($dest)) {
if (!mkdir($dest, 0777, true)) {
$last_successful_step = 0;
$last_successful_step_message = "Cannot create Directory for Files backup, please check permissions";
die('Failed to create folders...');
break;
}
}
//.........这里部分代码省略.........
示例5:
<link rel="stylesheet" type="text/css" href="<?php
echo Yii::app()->request->baseUrl;
?>
/css/main.css" />
<link rel="stylesheet" type="text/css" href="<?php
echo Yii::app()->request->baseUrl;
?>
/css/form.css" />
<title><?php
echo CHtml::encode($this->pageTitle);
?>
</title>
<?php
$setupModel = Setup::model()->findByPk(1);
?>
</head>
<body>
<?php
$company_logo = Yii::app()->request->baseUrl . "/images/company_logo.png";
$rapport_stock_logo = Yii::app()->request->baseUrl . "/images/rapport_stock_logo.png";
?>
<div class="container" id="page">
<table><tr>
<td style="margin:20px; vertical-align:middle;" ><div id="logo" ><a href="<?php
echo Yii::app()->request->baseUrl;
?>
示例6: actionNotifySupplier
public function actionNotifySupplier($id)
{
$model = $this->loadModel($id);
$setupModel = Setup::model()->findByPk(1);
$model = $this->loadModel($id);
$itemsOnOrderModel = $model->getItemsOnOrder($id);
$reciever_email = $model->suppliers->email;
$reciever_name = $model->suppliers->contact_person;
//$sender_email=Yii::app()->params['adminEmail'];
$sender_email = $setupModel->email;
//$sender_name=Yii::app()->params['company_name'];
$sender_name = $setupModel->company;
$message = new YiiMailMessage();
$message->setTo(array($reciever_email => $reciever_name));
$message->setFrom(array($sender_email => $sender_name));
$message->setSubject('Items missing or damaged - Purchase Order: ' . $model->order_number . ' ');
$message->setBody($this->renderPartial('finaliseOrder', array('model' => $model), true), 'text/html');
$numsent = Yii::app()->mail->send($message);
$numsent = 1;
if ($numsent == 1) {
$this->redirect(array('finaliseOrder', 'id' => $model->id));
} else {
$this->raiseEvent('Error', 'error');
}
//end of else
}