本文整理汇总了PHP中Period::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::model方法的具体用法?PHP Period::model怎么用?PHP Period::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::model方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBlankTempTrans
private function getBlankTempTrans($rownum, $invDate = null)
{
$comp = Company::model()->findbyPk(Yii::app()->user->getState('selectedCompanyId'));
$per = Period::model()->findbyPk(Yii::app()->user->getState('selectedPeriodId'));
$model = new TempTrans();
$model->rownum = $rownum;
$model->regDate = date('Y-m-d');
if ($invDate == null) {
$invDate = $model->regDate;
}
$model->invDate = $invDate;
$model->changedBy = Yii::app()->user->getState('displayname');
$model->dateChanged = $model->regDate;
$model->periodNum = $per->lastPeriodTransNum + 1;
$model->companyNum = $comp->lastAbsTransNum + 1;
$model->notesheader = '';
$model->fileInfo = '';
$model->fileInfo = 1;
$model->accountId = 0;
$model->customerId = 0;
$model->donorId = 0;
$model->notes = '';
$model->amountdebit = "";
$model->amountcredit = "";
$model->userId = Yii::app()->user->id;
$model->save();
$cLoc = CLocale::getInstance('en');
$model->invDate = User::getDateFormatted($model->invDate, $cLoc);
$model->regDate = User::getDateFormatted($model->regDate, $cLoc);
$model->dateChanged = $model->regDate;
return $model;
}
示例2: array
>
<fieldset class="field-row row">
<div class="large-<?php
echo $this->label_width;
?>
column">
<label for="followup_quantity">Follow up:</label>
</div>
<div class="large-<?php
echo $this->data_width;
?>
column end">
<?php
$html_options = array('empty' => '- Please select -', 'options' => array(), 'class' => 'inline');
echo CHtml::dropDownList($this->form_name . '[followup_quantity]', @$this->form_data[$this->form_name]['followup_quantity'], Yii::app()->params['follow_up_months'], $html_options);
echo CHtml::dropDownList($this->form_name . '[followup_period]', @$this->form_data[$this->form_name]['followup_period'], CHtml::listData(\Period::model()->findAll(array('order' => 'display_order')), 'name', 'name'), $html_options);
?>
</div>
</fieldset>
<fieldset class="field-row row">
<div class="large-<?php
echo $this->label_width;
?>
column">
<label for="site">Clinic location:</label>
</div>
<div class="large-<?php
echo $this->data_width;
?>
column end">
<?php
示例3: getCurrentPeriod
/**
* @return Period
*/
public static function getCurrentPeriod()
{
if (!self::$current) {
$start = new DateTime();
$start->setDate($start->format('Y'), $start->format('n'), 1)->setTime(0, 0, 0);
$end = clone $start;
$end = $end->modify('+' . cal_days_in_month(CAL_GREGORIAN, $start->format('n'), $start->format('Y')) . ' day')->modify('-1 sec');
$period = Period::model()->findByAttributes(array('period_from' => $start->format(Task::DF_INTER), 'period_to' => $end->format(Task::DF_INTER)));
if ($period == NULL) {
$period = new Period();
$period->period_from = $start->format(Task::DF_INTER);
$period->period_to = $end->format(Task::DF_INTER);
$period->status = self::STATUS_ACTIVE;
$period->name = $start->format('F, Y');
try {
$period->save();
} catch (Exception $e) {
}
}
self::$current = $period;
}
return self::$current;
}
示例4: array
>
<fieldset class="field-row row">
<legend class="large-3 column">
<?php
echo $element->getAttributeLabel('followup_quantity');
?>
:
</legend>
<div class="large-9 column end">
<?php
$html_options = array('empty' => '- Please select -', 'options' => array());
echo CHtml::activeDropDownList($element, 'followup_quantity', $element->getFollowUpQuantityOptions(), array_merge($html_options, array('class' => 'inline')));
?>
<?php
$html_options = array('empty' => '- Please select -', 'options' => array());
echo CHtml::activeDropDownList($element, 'followup_period_id', CHtml::listData(\Period::model()->findAll(array('order' => 'display_order')), 'id', 'name'), array_merge($html_options, array('class' => 'inline')));
?>
<label class="inline">
<?php
echo CHtml::activeCheckBox($element, 'community_patient');
?>
<?php
echo $element->getAttributeLabel('community_patient');
?>
</label>
</div>
</fieldset>
</div>
<div id="div_<?php
echo CHtml::modelName($element);
开发者ID:across-health,项目名称:OphCiExamination,代码行数:31,代码来源:form_Element_OphCiExamination_ClinicOutcome.php
示例5: loadPeriod
/**
* 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 the primary key value. Defaults to null, meaning using the 'id' GET variable
*/
public function loadPeriod($id = null)
{
if ($this->_model === null) {
if ($id !== null || isset($_GET['id'])) {
$this->_model = Period::model()->findbyPk($id !== null ? $id : $_GET['id']);
}
if ($this->_model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
}
return $this->_model;
}
示例6: get_class
<fieldset class="row field-row">
<legend class="large-2 column">
<?php
echo $model->getAttributeLabel('monitoring_frequency');
?>
:
</legend>
<div class="large-1 column">
<label for="<?php
echo get_class($model) . '_monitoring_frequency';
?>
">
Every
</label>
</div>
<div class="large-1 column">
<?php
echo $form->textField($model, 'monitoring_frequency', array('autocomplete' => Yii::app()->params['html_autocomplete'], 'nowrapper' => true));
?>
</div>
<div class="large-3 column end">
<?php
echo $form->dropDownList($model, 'monitoring_frequency_period_id', CHtml::listData(Period::model()->findAll(), 'id', 'name'), array('nowrapper' => true));
?>
</div>
</fieldset>
<?php
echo $form->textArea($model, 'duration');
echo $form->textArea($model, 'toxicity');
示例7: actionPeriod
public function actionPeriod($periodId)
{
$period = Period::model()->findByPk($periodId);
if ($period === NULL) {
throw new CHttpException(404, 'The requested page does not exist.');
}
if ($this->_user()->role == User::ROLE_USER) {
return $this->actionUser($periodId);
}
$model = new Task('search');
$model->unsetAttributes();
// clear any default values
$model->period_id = $periodId;
if (isset($_GET['Task'])) {
$model->attributes = $_GET['Task'];
}
$this->render('period', array('model' => $model, 'period' => $period));
}
示例8: setStates
/**
* set all the states for the CWebUser
*/
public function setStates($force = false)
{
$webapp = Yii::app()->user;
if ($webapp->id == $this->id || $force) {
$webapp->setState('displayname', $this->displayname);
$webapp->setState('negativeAssetTrans', $this->negativeAssetTrans);
$webapp->setState('thaiconnectionsUser', $this->thaiconnectionsUser);
$webapp->setState('tagList', $this->tagList);
$webapp->setState('accountList', $this->accountList);
$webapp->setState('reportIds', $this->reportIds);
$webapp->setState('selectedCompany', '');
$webapp->setState('selectedPeriod', '');
if (isset($this->selectedCompanyId)) {
$comp = Company::model()->findbyPk($this->selectedCompanyId);
if (isset($comp)) {
$webapp->setState('selectedCompany', $comp->name);
} else {
$this->selectedCompanyId = 0;
$this->selectedPeriodId = 0;
$this->confirmPassword = $this->password;
$this->save();
}
}
if (isset($this->selectedPeriodId)) {
$per = Period::model()->findbyPk($this->selectedPeriodId);
if (isset($per)) {
$webapp->setState('selectedPeriodStart', $per->dateStart);
$webapp->setState('selectedPeriodEnd', $per->dateEnd);
} else {
//$this->selectedCompanyId=0;
$this->selectedPeriodId = 0;
$this->confirmPassword = $this->password;
$this->save();
}
}
$webapp->setState('selectedCompanyId', $this->selectedCompanyId);
$webapp->setState('selectedPeriodId', $this->selectedPeriodId);
$allowCompanySelect = false;
if (isset($this->companies)) {
if (count($this->companies) > 1) {
$allowCompanySelect = true;
}
}
$webapp->setState('allowCompanySelect', $allowCompanySelect);
}
$this->setOptionStatesAndControlTable($force, false, $webapp, $this->optionsWebTemplate(), 0, 0);
$this->setOptionStatesAndControlTable($force, false, $webapp, $this->optionsUserTemplate(), 0, $this->id);
$this->setOptionStatesAndControlTable($force, !isset($this->selectedCompanyId) || $this->selectedCompanyId == 0, $webapp, $this->optionsCompanyUserTemplate(), $this->selectedCompanyId, $this->id);
$this->setOptionStatesAndControlTable($force, !isset($this->selectedCompanyId) || $this->selectedCompanyId == 0, $webapp, $this->optionsCompanyTemplate(), $this->selectedCompanyId, 0);
//echo 'en';die();
Yii::app()->setLanguage('en');
}
示例9: exportCompany
private function exportCompany($companyId = null)
{
$compName = "AllCompanies";
if ($companyId != null) {
$compName = CompanyController::replace_bad_filename_chars(Company::model()->findbyPk($companyId)->name);
}
// set headers
header("Pragma: no-cache");
header("Expires: 0");
header("Content-Description: File Transfer");
header("Content-Type: text/xml");
header("Content-Disposition: attachment; filename=\"lazy8webExport.Company." . $compName . "." . date('Y-m-d_H.i.s') . ".xml\"");
header("Content-Transfer-Encoding: binary");
//safari can't deal with this header length zero
// header("Content-Length: " );
$writer = new XMLWriter();
// Output directly to the user
//dirname(__FILE__).DIRECTORY_SEPARATOR.'../..'.'/assets/upload.sql'
$writer->openURI('php://output');
$writer->startDocument('1.0', 'utf-8');
$writer->setIndent(4);
$writer->startElement('lazy8webport');
$writer->writeAttribute('version', '1.00');
$companies = array();
if (isset($companyId)) {
$companies[] = Company::model()->findbyPk($companyId);
} else {
$companies = Company::model()->findAll(array('order' => 'code'));
}
foreach ($companies as $company) {
ChangeLog::addLog('OTHER', 'Company', 'Exported company ' . $company->toString());
$writer->startElement('company');
$writer->writeAttribute("code", $company->code);
$writer->writeAttribute("name", $company->name);
$writer->writeAttribute("lastAbsTransNum", $company->lastAbsTransNum);
$allAccounts = array();
$accountTypes = AccountType::model()->findAll(array('condition' => 'companyId=' . $company->id, 'order' => 'code'));
foreach ($accountTypes as $accountType) {
$writer->startElement('accounttype');
$writer->writeAttribute("code", $accountType->code);
$writer->writeAttribute("name", $accountType->name);
$writer->writeAttribute("sortorder", $accountType->sortOrder);
$writer->writeAttribute("isinbalance", $accountType->isInBalance);
$accounts = Account::model()->findAll(array('condition' => 'companyId=' . $company->id . ' AND accountTypeId=' . $accountType->id, 'order' => 'code'));
foreach ($accounts as $account) {
$allAccounts[$account->id] = $account->code;
$writer->startElement('account');
$writer->writeAttribute("code", $account->code);
$writer->writeAttribute("name", $account->name);
$writer->endElement();
}
$writer->endElement();
}
$customers = Customer::model()->findAll(array('condition' => 'companyId=' . $company->id, 'order' => 'code'));
$allCustomers = array();
foreach ($customers as $customer) {
$writer->startElement('customer');
$allCustomers[$customer->id] = $customer->code;
$writer->writeAttribute("code", $customer->code);
$writer->writeAttribute("name", $customer->name);
$writer->writeAttribute("desc", $customer->desc);
if (isset($allAccounts[$customer->accountId])) {
$writer->writeAttribute("accountcode", $allAccounts[$customer->accountId]);
} else {
$writer->writeAttribute("accountcode", 0);
}
$writer->endElement();
}
$periods = Period::model()->findAll(array('condition' => 'companyId=' . $company->id, 'order' => 'dateStart'));
foreach ($periods as $period) {
$writer->startElement('period');
$writer->writeAttribute("datestart", $period->dateStart);
$writer->writeAttribute("dateend", $period->dateEnd);
$writer->writeAttribute("lastperiodtransnum", $period->lastPeriodTransNum);
$transactions = Trans::model()->findAll(array('condition' => 'companyId=' . $company->id . ' AND periodId=' . $period->id, 'order' => 'companyNum'));
foreach ($transactions as $transaction) {
$writer->startElement('transaction');
$writer->writeAttribute("code", $transaction->companyNum);
$writer->writeAttribute("periodnum", $transaction->periodNum);
$writer->writeAttribute("regdate", $transaction->regDate);
$writer->writeAttribute("invdate", $transaction->invDate);
$writer->writeAttribute("notes", $transaction->notes);
$writer->writeAttribute("fileinfo", $transaction->fileInfo);
$transrows = TransRow::model()->findAll(array('condition' => 'transId=' . $transaction->id, 'order' => 'amount DESC'));
foreach ($transrows as $transrow) {
$writer->startElement('amount');
$writer->writeAttribute("accountcode", isset($allAccounts[$transrow->accountId]) ? $allAccounts[$transrow->accountId] : 0);
$writer->writeAttribute("customercode", isset($allCustomers[$transrow->customerId]) ? $allCustomers[$transrow->customerId] : 0);
$writer->writeAttribute("notes", $transrow->notes);
$writer->writeAttribute("amount", $transrow->amount);
$writer->endElement();
}
$writer->endElement();
}
$writer->endElement();
}
yii::app()->onExport(new Lazy8Event(array('exportobject' => 'Company', 'writer' => $writer), $company->id));
$writer->endElement();
}
$writer->endElement();
//.........这里部分代码省略.........
示例10: fixOldFiles
public static function fixOldFiles()
{
/**
* @var $file File
* @var $task Task
* @var $period Period
*/
echo "<pre>";
$periods = Period::model()->findAll();
foreach ($periods as $period) {
$periodDir = UPLOAD_DIR . $period->id . DS;
if (!is_dir($periodDir)) {
try {
mkdir($periodDir);
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
}
echo "PERIOD {$period->name}---------------------------------\n";
$tasks = $period->tasks;
if (is_dir($periodDir)) {
foreach ($tasks as $task) {
$taskDir = $periodDir . $task->id . DS;
if (!is_dir($taskDir)) {
try {
mkdir($taskDir);
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
}
$files = $task->files;
echo ">>>TASK {$task->name}---------------------------------\n";
if (is_dir($taskDir)) {
foreach ($files as $file) {
if ($file->realname && file_exists(UPLOAD_DIR . '__ALL__' . DS . $file->realname)) {
print_r($file->getAttributes());
try {
$newDir = $taskDir . $file->realname;
if (rename(UPLOAD_DIR . '__ALL__' . DS . $file->realname, $newDir)) {
echo ">>>>>>>>FILE MOVED {$file->realname}\n";
} else {
echo ">>>>>>>>FILE CANNOT MOVED {$file->realname}\n";
}
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
flush();
}
}
}
flush();
}
}
flush();
}
}