本文整理汇总了PHP中Quota类的典型用法代码示例。如果您正苦于以下问题:PHP Quota类的具体用法?PHP Quota怎么用?PHP Quota使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Quota类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllQuota
public static function getAllQuota()
{
$Data = Quota::model()->findAll();
$res = array();
foreach ($Data as $record) {
$res[$record->idQuota] = $record->QuotaName;
}
return $res;
}
示例2: deleteQuota
function deleteQuota($condition = false, $recursive = true)
{
if ($recursive == true) {
$oResult = Quota::model()->findAllByAttributes($condition);
foreach ($oResult as $aRow) {
Quota_languagesettings::model()->deleteAllByAttributes(array('quotals_quota_id' => $aRow['id']));
Quota_members::model()->deleteAllByAttributes(array('quota_id' => $aRow['id']));
}
}
Quota::model()->deleteAllByAttributes($condition);
}
示例3: testAddsNewQuota
public function testAddsNewQuota()
{
$duration = QuotaDuration::Month;
$limit = 2.4;
$unit = QuotaUnit::Reservations;
$resourceId = 2183;
$groupId = 123987;
$scheduleId = 102983;
$quota = Quota::Create($duration, $limit, $unit, $resourceId, $groupId, $scheduleId);
$command = new AddQuotaCommand($duration, $limit, $unit, $resourceId, $groupId, $scheduleId);
$this->repository->Add($quota);
$this->assertEquals($command, $this->db->_LastCommand);
}
示例4: testWhenHourlyLimitIsExceededInYear
public function testWhenHourlyLimitIsExceededInYear()
{
$duration = new QuotaDurationYear();
$limit = new QuotaLimitHours(1.5);
$startDate = Date::Parse('2011-04-03 0:30', $this->schedule->GetTimezone());
$endDate = Date::Parse('2011-04-03 1:30', $this->schedule->GetTimezone());
$series = $this->GetHourLongReservation($startDate, $endDate);
$quota = new Quota(1, $duration, $limit, $series->ResourceId());
$res1 = new ReservationItemView('ref1', $startDate->SetTimeString('00:00'), $endDate->SetTimeString('00:31'), '', $series->ResourceId(), 98712);
$res1->ScheduleId = $series->ScheduleId();
$reservations = array($res1);
$this->SearchReturns($reservations);
$exceeds = $quota->ExceedsQuota($series, $this->user, $this->schedule, $this->reservationViewRepository);
$this->assertTrue($exceeds);
}
示例5: getQuotaInformation
/**
* getQuotaInformation() returns quota information for the current survey
* @param string $surveyid - Survey identification number
* @param string $language - Language of the quota
* @param string $quotaid - Optional quotaid that restricts the result to a given quota
* @return array - nested array, Quotas->Members
*/
function getQuotaInformation($surveyid, $language, $iQuotaID = null)
{
Yii::log('getQuotaInformation');
$baselang = Survey::model()->findByPk($surveyid)->language;
$aAttributes = array('sid' => $surveyid);
if ((int) $iQuotaID) {
$aAttributes['id'] = $iQuotaID;
}
$aQuotas = Quota::model()->with(array('languagesettings' => array('condition' => "quotals_language='{$language}'")))->findAllByAttributes($aAttributes);
$aSurveyQuotasInfo = array();
$x = 0;
$surveyinfo = getSurveyInfo($surveyid, $language);
// Check all quotas for the current survey
if (count($aQuotas) > 0) {
foreach ($aQuotas as $oQuota) {
// Array for each quota
$aQuotaInfo = array_merge($oQuota->attributes, $oQuota->languagesettings[0]->attributes);
// We have only one language, then we can use first only
$aQuotaMembers = QuotaMember::model()->findAllByAttributes(array('quota_id' => $oQuota->id));
$aQuotaInfo['members'] = array();
if (count($aQuotaMembers) > 0) {
foreach ($aQuotaMembers as $oQuotaMember) {
$oMemberQuestion = Question::model()->findByAttributes(array('qid' => $oQuotaMember->qid, 'language' => $baselang));
if ($oMemberQuestion) {
$sFieldName = "0";
if ($oMemberQuestion->type == "I" || $oMemberQuestion->type == "G" || $oMemberQuestion->type == "Y") {
$sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid;
$sValue = $oQuotaMember->code;
}
if ($oMemberQuestion->type == "L" || $oMemberQuestion->type == "O" || $oMemberQuestion->type == "!") {
$sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid;
$sValue = $oQuotaMember->code;
}
if ($oMemberQuestion->type == "M") {
$sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid . $oQuotaMember->code;
$sValue = "Y";
}
if ($oMemberQuestion->type == "A" || $oMemberQuestion->type == "B") {
$temp = explode('-', $oQuotaMember->code);
$sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid . $temp[0];
$sValue = $temp[1];
}
$aQuotaInfo['members'][] = array('title' => $oMemberQuestion->title, 'type' => $oMemberQuestion->type, 'code' => $oQuotaMember->code, 'value' => $sValue, 'qid' => $oQuotaMember->qid, 'fieldname' => $sFieldName);
}
}
}
// Push this quota Information to all survey quota
array_push($aSurveyQuotasInfo, $aQuotaInfo);
}
}
return $aSurveyQuotasInfo;
}
示例6: unlimitedQuotaHasAlwaysSpaceLeft
/**
* @test
*/
public function unlimitedQuotaHasAlwaysSpaceLeft()
{
$this->assertEquals(303, Quota::unlimited()->spaceLeft(303));
}
示例7: XMLImportSurvey
/**
* This function imports a LimeSurvey .lss survey XML file
*
* @param mixed $sFullFilePath The full filepath of the uploaded file
*/
function XMLImportSurvey($sFullFilePath, $sXMLdata = NULL, $sNewSurveyName = NULL, $iDesiredSurveyId = NULL, $bTranslateInsertansTags = true, $bConvertInvalidQuestionCodes = true)
{
Yii::app()->loadHelper('database');
$clang = Yii::app()->lang;
$aGIDReplacements = array();
if ($sXMLdata == NULL) {
$sXMLdata = file_get_contents($sFullFilePath);
}
$xml = @simplexml_load_string($sXMLdata, 'SimpleXMLElement', LIBXML_NONET);
if (!$xml || $xml->LimeSurveyDocType != 'Survey') {
$results['error'] = $clang->gT("This is not a valid LimeSurvey survey structure XML file.");
return $results;
}
$pre_personal_characteristics = "";
$question_groups['R'] = array();
$question_groups['I'] = array();
$question_groups['O'] = array();
$iDBVersion = (int) $xml->DBVersion;
$aQIDReplacements = array();
$aQuestionCodeReplacements = array();
$aQuotaReplacements = array();
$results['defaultvalues'] = 0;
$results['answers'] = 0;
$results['surveys'] = 0;
$results['questions'] = 0;
$results['subquestions'] = 0;
$results['question_attributes'] = 0;
$results['groups'] = 0;
$results['assessments'] = 0;
$results['quota'] = 0;
$results['quotals'] = 0;
$results['quotamembers'] = 0;
$results['survey_url_parameters'] = 0;
$results['importwarnings'] = array();
$aLanguagesSupported = array();
foreach ($xml->languages->language as $language) {
$aLanguagesSupported[] = (string) $language;
}
$results['languages'] = count($aLanguagesSupported);
// Import surveys table ====================================================
foreach ($xml->surveys->rows->row as $row) {
$insertdata = array();
foreach ($row as $key => $value) {
$insertdata[(string) $key] = (string) $value;
}
$iOldSID = $results['oldsid'] = $insertdata['sid'];
if ($iDesiredSurveyId != NULL) {
$insertdata['wishSID'] = GetNewSurveyID($iDesiredSurveyId);
} else {
$insertdata['wishSID'] = $iOldSID;
}
if ($iDBVersion < 145) {
if (isset($insertdata['private'])) {
$insertdata['anonymized'] = $insertdata['private'];
}
unset($insertdata['private']);
unset($insertdata['notification']);
}
//Make sure it is not set active
$insertdata['active'] = 'N';
//Set current user to be the owner
$insertdata['owner_id'] = Yii::app()->session['loginID'];
if (isset($insertdata['bouncetime']) && $insertdata['bouncetime'] == '') {
$insertdata['bouncetime'] = NULL;
}
if (isset($insertdata['showXquestions'])) {
$insertdata['showxquestions'] = $insertdata['showXquestions'];
unset($insertdata['showXquestions']);
}
// Special code to set javascript in
Yii::app()->loadHelper('admin/template');
$newname = "watson_" . time();
$newdirname = Yii::app()->getConfig('usertemplaterootdir') . "/" . $newname;
$copydirname = getTemplatePath("watson_personal_constructs_copy_me");
$oFileHelper = new CFileHelper();
$mkdirresult = mkdir_p($newdirname);
if ($mkdirresult == 1) {
$oFileHelper->copyDirectory($copydirname, $newdirname);
$templatename = $newname;
//$this->index("startpage.pstpl", "welcome", $templatename);
} elseif ($mkdirresult == 2) {
$results['Error'] = sprintf($clang->gT("Directory with the name `%s` already exists - choose another name", "js"), $newname);
} else {
$results['Error'] = sprintf($clang->gT("Unable to create directory `%s`.", "js"), $newname) . " " . $clang->gT("Please check the directory permissions.", "js");
}
$insertdata['template'] = $newname;
// End special copy code (taken from templates.php templatecopy() method
if (isset($insertdata['googleAnalyticsStyle'])) {
$insertdata['googleanalyticsstyle'] = $insertdata['googleAnalyticsStyle'];
unset($insertdata['googleAnalyticsStyle']);
}
if (isset($insertdata['googleAnalyticsAPIKey'])) {
$insertdata['googleanalyticsapikey'] = $insertdata['googleAnalyticsAPIKey'];
unset($insertdata['googleAnalyticsAPIKey']);
}
//.........这里部分代码省略.........
示例8: rgb
</tr>
<tr class="row">
<td class="col1">
<?php
$sem = AcademicTerm::model()->findByPk($stud_trans[0]['student_academic_term_name_id'])->academic_term_name;
$acdm_period = AcademicTermPeriod::model()->findByPk($stud_trans[0]['student_academic_term_period_tran_id'])->academic_term_period;?>
Current/Last Semester </td>
<td class="col2"> <?php echo "Sem-".$sem; ?></td>
</tr>
<tr class="row">
<td class="col1">Current/Passing Academic Year </td>
<td class="col2"><?php echo $acdm_period ?></td>
</tr>
<tr class="row">
<td class="col1">Quota </td>
<td class="col2"><?php echo Quota::model()->findByPk($stud_trans[0]['student_transaction_quota_id'])->quota_name;?></td>
</tr>
</table>
<div> </div>
<?php
if(!empty($stud_archive))
{
?>
<table class="table_data">
<th colspan="4" style="font-size: 18px; color: rgb(255, 255, 255);">
Student History Record
</th>
<tr class="table_header">
<th>SI No.</th>
<th>Academic Year</th>
<th>Semester</th>
示例9: deleteSurvey
/**
* Deletes a survey and all its data
*
* @access public
* @param int $iSurveyID
* @param bool @recursive
* @return void
*/
public function deleteSurvey($iSurveyID, $recursive = true)
{
Survey::model()->deleteByPk($iSurveyID);
if ($recursive == true) {
if (tableExists("{{survey_" . intval($iSurveyID) . "}}")) {
Yii::app()->db->createCommand()->dropTable("{{survey_" . intval($iSurveyID) . "}}");
}
if (tableExists("{{survey_" . intval($iSurveyID) . "_timings}}")) {
Yii::app()->db->createCommand()->dropTable("{{survey_" . intval($iSurveyID) . "_timings}}");
}
if (tableExists("{{tokens_" . intval($iSurveyID) . "}}")) {
Yii::app()->db->createCommand()->dropTable("{{tokens_" . intval($iSurveyID) . "}}");
}
$oResult = Questions::model()->findAllByAttributes(array('sid' => $iSurveyID));
foreach ($oResult as $aRow) {
Answers::model()->deleteAllByAttributes(array('qid' => $aRow['qid']));
Conditions::model()->deleteAllByAttributes(array('qid' => $aRow['qid']));
Question_attributes::model()->deleteAllByAttributes(array('qid' => $aRow['qid']));
Defaultvalues::model()->deleteAllByAttributes(array('qid' => $aRow['qid']));
}
Questions::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
Assessment::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
Groups::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
Surveys_languagesettings::model()->deleteAllByAttributes(array('surveyls_survey_id' => $iSurveyID));
Survey_permissions::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
Saved_control::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
Survey_url_parameters::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
Quota::model()->deleteQuota(array('sid' => $iSurveyID), true);
}
}
示例10: foreach
?>
<table class="table table-striped table-bordered table-condensed" id="tabellaUtenti">
<thead>
<th>N.</th>
<th>Nome</th>
<th>Cognome</th>
<th>Comitato</th>
<th>Data versamento</th>
<th>Quota</th>
<th>Stato</th>
<th>Azioni</th>
</thead>
<?php
foreach ($appartenenza as $app) {
$q = Quota::filtra([['appartenenza', $app]], 'timestamp DESC');
foreach ($q as $_q) {
?>
<tr>
<td><?php
echo $_q->progressivo();
?>
</td>
<td><?php
echo $_q->volontario()->nome;
?>
</td>
<td><?php
echo $_q->volontario()->cognome;
?>
</td>
示例11: operator
<h1>Previous Fees Category</h1>
<!--<p>
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>-->
<?php
//echo CHtml::link('Advanced Search','#',array('class'=>'search-button'));
?>
<div class="search-form" style="display:none">
<?php
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->
<?php
$dataProvider = $model->search();
if (Yii::app()->user->getState("pageSize", @$_GET["pageSize"])) {
$pageSize = Yii::app()->user->getState("pageSize", @$_GET["pageSize"]);
} else {
$pageSize = Yii::app()->params['pageSize'];
}
$dataProvider->getPagination()->setPageSize($pageSize);
?>
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'fees-master-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'columns' => array(array('header' => 'SI No', 'class' => 'IndexColumn'), 'fees_master_name', array('name' => 'fees_quota_id', 'value' => 'Quota::model()->findByPk($data->fees_quota_id)->quota_name', 'filter' => CHtml::listData(Quota::model()->findAll(array('condition' => 'quota_organization_id=' . Yii::app()->user->getState('org_id'))), 'quota_id', 'quota_name')), array('class' => 'MyCButtonColumn', 'template' => '{view}')), 'pager' => array('class' => 'AjaxList', 'maxButtonCount' => $model->count(), 'header' => '')));
示例12: getQuotaInformation
/**
* getQuotaInformation() returns quota information for the current survey
* @param string $surveyid - Survey identification number
* @param string $language - Language of the quota
* @param string $quotaid - Optional quotaid that restricts the result to a given quota
* @return array - nested array, Quotas->Members->Fields
*/
function getQuotaInformation($surveyid, $language, $iQuotaID = 'all')
{
Yii::log('getQuotaInformation');
$baselang = Survey::model()->findByPk($surveyid)->language;
$aAttributes = array('sid' => $surveyid);
if ($iQuotaID != 'all') {
$aAttributes['id'] = $iQuotaID;
}
$result = Quota::model()->with(array('languagesettings' => array('condition' => "quotals_language='{$language}'")))->findAllByAttributes($aAttributes);
$quota_info = array();
$x = 0;
$surveyinfo = getSurveyInfo($surveyid, $language);
// Check all quotas for the current survey
//if ($result->RecordCount() > 0)
if (count($result) > 0) {
//while ($survey_quotas = $result->FetchRow())
foreach ($result as $_survey_quotas) {
$survey_quotas = array_merge($_survey_quotas->attributes, $_survey_quotas->languagesettings[0]->attributes);
// We have only one language, then we can use first only
array_push($quota_info, $survey_quotas);
$result_qe = QuotaMember::model()->findAllByAttributes(array('quota_id' => $survey_quotas['id']));
$quota_info[$x]['members'] = array();
if (count($result_qe) > 0) {
foreach ($result_qe as $quota_entry) {
$quota_entry = $quota_entry->attributes;
$oMemberQuestion = Question::model()->findByAttributes(array('qid' => $quota_entry['qid'], 'language' => $baselang));
if ($oMemberQuestion) {
$fieldname = "0";
if ($oMemberQuestion->type == "I" || $oMemberQuestion->type == "G" || $oMemberQuestion->type == "Y") {
$fieldname = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $quota_entry['qid'];
$value = $quota_entry['code'];
}
if ($oMemberQuestion->type == "L" || $oMemberQuestion->type == "O" || $oMemberQuestion->type == "!") {
$fieldname = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $quota_entry['qid'];
$value = $quota_entry['code'];
}
if ($oMemberQuestion->type == "M") {
// Need to remove invalid $quota_entry['code']
$fieldname = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $quota_entry['qid'] . $quota_entry['code'];
$value = "Y";
}
if ($oMemberQuestion->type == "A" || $oMemberQuestion->type == "B") {
$temp = explode('-', $quota_entry['code']);
$fieldname = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $quota_entry['qid'] . $temp[0];
$value = $temp[1];
}
array_push($quota_info[$x]['members'], array('Title' => $oMemberQuestion->title, 'type' => $oMemberQuestion->type, 'code' => $quota_entry['code'], 'value' => $value, 'qid' => $quota_entry['qid'], 'fieldname' => $fieldname));
}
}
}
$x++;
}
}
return $quota_info;
}
示例13: array
echo $form->labelEx($model, 'student_transaction_religion_id');
?>
<?php
echo $form->dropDownList($model, 'student_transaction_religion_id', Religion::items(), array('empty' => 'Select Religion'));
?>
<span class="status"> </span>
<?php
echo $form->error($model, 'student_transaction_religion_id');
?>
</div>
<div class="row-right">
<?php
echo $form->labelEx($model, 'student_transaction_quota_id');
?>
<?php
echo $form->dropDownList($model, 'student_transaction_quota_id', Quota::items(), array('empty' => 'Select Quota'));
?>
<span class="status"> </span>
<?php
echo $form->error($model, 'student_transaction_quota_id');
?>
</div>
</div>
<div class="row">
<div class="row-left">
<?php
echo $form->labelEx($model, 'student_transaction_category_id');
?>
<?php
echo $form->dropDownList($model, 'student_transaction_category_id', Category::items(), array('empty' => 'Select Category'));
示例14: quote
/**
* Restituisce le quote di un particolare tesseramento
* @return Quote elenco delle quote di un particolare anno
*/
public function quote()
{
return Quota::filtra([['anno', $this->anno]]);
}
示例15: array
?>
</div>
<?php
}
if (Yii::app()->user->hasFlash('success')) {
?>
<div class="flash-success">
<?php
echo Yii::app()->user->getFlash('success');
?>
</div>
<?php
}
?>
</div>
<?php
$dataProvider = $model->search();
if (Yii::app()->user->getState("pageSize", @$_GET["pageSize"])) {
$pageSize = Yii::app()->user->getState("pageSize", @$_GET["pageSize"]);
} else {
$pageSize = Yii::app()->params['pageSize'];
}
$dataProvider->getPagination()->setPageSize($pageSize);
?>
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'student-transaction-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'ajaxUpdate' => false, 'columns' => array(array('header' => 'SI No', 'class' => 'IndexColumn'), array('name' => 'student_enroll_no', 'value' => '$data->Rel_Stud_Info->student_enroll_no'), array('name' => 'student_roll_no', 'value' => '$data->Rel_Stud_Info->student_roll_no'), array('name' => 'student_first_name', 'value' => '$data->Rel_Stud_Info->student_first_name'), array('name' => 'student_last_name', 'value' => '$data->Rel_Stud_Info->student_last_name'), array('name' => 'student_transaction_branch_id', 'value' => 'Branch::model()->findByPk($data->student_transaction_branch_id)->branch_name', 'filter' => CHtml::listData(Branch::model()->findAll(array('condition' => 'branch_organization_id=' . Yii::app()->user->getState('org_id'))), 'branch_id', 'branch_name')), array('name' => 'student_transaction_quota_id', 'value' => 'Quota::model()->findByPk($data->student_transaction_quota_id)->quota_name', 'filter' => CHtml::listData(Quota::model()->findAll(array('condition' => 'quota_organization_id=' . Yii::app()->user->getState('org_id'))), 'quota_id', 'quota_name')), array('name' => 'student_academic_term_period_tran_id', 'value' => 'AcademicTermPeriod::model()->findByPk($data->student_academic_term_period_tran_id)->academic_term_period'), array('name' => 'student_academic_term_name_id', 'value' => 'AcademicTerm::model()->findByPk($data->student_academic_term_name_id)->academic_term_name', 'filter' => CHtml::listData(AcademicTerm::model()->findAll(array('condition' => 'current_sem=1 and academic_term_organization_id=' . Yii::app()->user->getState('org_id'))), 'academic_term_id', 'academic_term_name')), array('name' => 'student_dtod_regular_status', 'value' => '$data->Rel_Stud_Info->student_dtod_regular_status'), array('name' => 'status_name', 'value' => '$data->Rel_Status->status_name'), array('type' => 'raw', 'value' => 'CHtml::image("../stud_images/" . $data->Rel_Photos->student_photos_path, "No Image",array("width"=>"20px","height"=>"20px"))'), array('class' => 'MyCButtonColumn', 'template' => '{update} {delete} ', 'buttons' => array('Add Fees' => array('label' => 'Pay Fees', 'url' => 'Yii::app()->createUrl("feesPaymentTransaction/create", array("id"=>$data->student_transaction_id))', 'imageUrl' => Yii::app()->baseUrl . '/images/add.jpeg', 'options' => array('class' => 'fees'))))), 'pager' => array('class' => 'AjaxList', 'maxButtonCount' => $model->count(), 'header' => '')));