public function calculateScore() { include_once 'models/tenders.php'; $ten = new Tender($this->tenderid); if ($soq = $ten->getQuestionnaire()) { if ($soqres = $this->getQuestionnaireResponse()) { $totalmarks = 0; $n = sizeof($soqres); for ($i = 0; $i < $n; $i++) { $optionselected = $soq[$i]->options[$soqres[$i]]; $totalmarks += $optionselected->marks; } $this->score = $totalmarks; return $totalmarks; } else { return false; } } else { return false; } }
/** * 失败的赞助 */ public function actionFitTenderTradeno() { if (!isset($_POST['tender_id']) || !isset($_POST['trade_no'])) { $status = array('status' => 0, "info" => '用户名或者密码错误!'); echo json_encode($status); Yii::app()->end(); } #更改赞助信息的状态 $result = Tender::model()->updateByPk($_POST['tender_id'], array("trade_no" => $_POST['trade_no']), "user_id=:user_id AND status=0", array(":user_id" => Yii::app()->user->getId())); if ($result) { $status = array('status' => 1, "info" => '提交成功'); } else { $status = array('status' => 0, "info" => '提交失败'); } echo json_encode($status); Yii::app()->end(); }
/** * Lists all models. */ public function actionIndex() { $model = new Favorite('search'); $model->unsetAttributes(); // clear any default values if (isset($_REQUEST['Favorite'])) { $model->attributes = $_GET['Favorite']; } // $favorites = Favorite::model()->findAll('modelName LIKE :t ',array(':t' => '%'.$model->modelName.'%')); $favorites = Favorite::model()->findAllBySql(' select f.* FROM Favorite `f` LEFT JOIN Tender ON tenderId = modelId AND modelName=\'Tender\' LEFT JOIN Transport ON transportId = modelId AND modelName=\'Transport\' LEFT JOIN Cargo ON cargoId = modelId AND modelName=\'Cargo\' LEFT JOIN User ON User.userId = modelId AND modelName=\'User\' where f.userId = :u AND modelName LIKE :t AND ( NOT ISNULL( tenderId ) OR NOT ISNULL( cargoId ) OR NOT ISNULL( User.userId ) OR NOT ISNULL( transportId ) )', array(':t' => '%' . $model->modelName . '%', ':u' => Yii::app()->user->id)); $ids = array(); foreach ($favorites as $it) { $ids[$it['modelName']][] = Yii::app()->db->quoteValue($it['modelId']); } /** * Disable all defaults scopes */ Cargo::disableDefaultScope(); Transport::disableDefaultScope(); Tender::disableDefaultScope(); User::disableDefaultScope(); $cargoes = new CActiveDataProvider('Cargo', array('criteria' => array('condition' => 'cargo.cargoId in (' . ($ids['Cargo'] ? implode(',', $ids['Cargo']) : 0) . ')'), 'pagination' => false)); $transports = new CActiveDataProvider('Transport', array('criteria' => array('condition' => 'transport.type = ' . Transport::TRANSPORT . ' AND transport.transportId in (' . ($ids['Transport'] ? implode(',', $ids['Transport']) : 0) . ')'), 'pagination' => false)); $tenders = new CActiveDataProvider('Tender', array('criteria' => array('condition' => 'tender.tenderId in (' . ($ids['Tender'] ? implode(',', $ids['Tender']) : -1) . ')'), 'pagination' => false)); $users = new CActiveDataProvider('User', array('criteria' => array('condition' => 'User.userId in (' . ($ids['User'] ? implode(',', $ids['User']) : -1) . ')'), 'pagination' => false)); $this->render('index', array('cargoes' => $cargoes, 'transports' => $transports, 'tenders' => $tenders, 'users' => $users, 'model' => $model)); }
?> : <?php echo $value->title; ?> </div></a> <div class="row"> Closing date: <?php echo $value->closedate; ?> <br> Closing time: <?php echo $value->closetime; ?> <br> <?php $item = new Tender($value->id); $tender_applicants = $item->getApplicants(); $no_applicants = sizeof($tender_applicants); if ($no_applicants) { ?> <br> <p class="hide" id="hide<?php echo $i; ?> " onclick="func(0,<?php echo $i; ?> );"><button class="pure-button pure-button-primary">View <?php echo $no_applicants; ?> Applications</button></p>
$unrestricted = $apl->userid == $_SESSION['id'] || $ten->ownerid == $_SESSION['id']; include_once 'views/tenders/applications/details.php'; } else { header('Location: /'); } } else { header('Location: /'); } break; default: header('Location: /404'); } } } else { include 'models/tenders.php'; $ten = new Tender(); $searching = false; $r; if (isset($_GET['s'])) { $searching = true; $terms = explode(' ', $_GET['s']); $r = $ten->getSearchResults($terms); } else { $page = 1; $countperpage = 5; $count = $ten->getCount(); if (isset($_GET['p'])) { $page = $_GET['p']; } if ($page < 1) { $page = 1;
/** * 处理信用筹资的状态 */ public function actionFittenderstatus() { if (isset($_REQUEST['id']) && isset($_REQUEST['lunbo_id']) && isset($_REQUEST['status'])) { #直接更改属于这个人的数据 #获得当前项目的拥有人 $thisproject = Project::model()->findByPk($_REQUEST['id'], "user_id=:user_id", array(":user_id" => Yii::app()->user->getId())); if ($thisproject) { #查询是否存在这个筹资记录 $thistender = Tender::model()->findByPk($_REQUEST['lunbo_id'], "project_id=:project_id", array(":project_id" => $thisproject->id)); if ($thistender) { //处理淘宝项目跟别的不一样 if ($thisproject->type == 3) { $addip = Yii::app()->request->userHostAddress; $user_id = Yii::app()->user->getId(); try { $conn = Yii::app()->db; $command = $conn->createCommand('call p_Fit_TaoBao_Tender(:user_id,:tender_id,:in_addip,@out_status,@out_remark)'); $command->bindParam(":user_id", $user_id, PDO::PARAM_INT); $command->bindParam(":tender_id", $thistender->id, PDO::PARAM_INT); $command->bindParam(":in_addip", $addip, PDO::PARAM_STR, 50); $command->execute(); $result = $conn->createCommand("select @out_status as status,@out_remark as remark")->queryRow(true); if ($result['status'] == 1) { echo 1; } else { echo $result['remark']; } } catch (Exception $e) { echo '系统繁忙,暂时无法处理'; } } else { $result = Tender::model()->updateByPk($_REQUEST['lunbo_id'], array("status" => $_REQUEST['status'])); #如果所有都处理完了,那么更新这个项目为成功的 if ($result) { $nums = Tender::model()->count("project_id=:project_id AND status=0", array(":project_id" => $thisproject->id)); if ($nums == 0) { Project::model()->updateByPk($thisproject->id, array("status" => 3)); } echo 1; } else { echo '错误的操作'; } } } else { echo '错误的操作'; } } else { echo '错误的操作'; } } else { echo '错误的操作'; } Yii::app()->end(); }
public function getTendername() { $q = Input::get('term'); $proj = new Tender(); $qproj = new MongoRegex('/' . $q . '/i'); $res = $proj->find(array('$or' => array(array('title' => $qproj), array('tenderNumber' => $qproj))), array('title', 'tenderNumber')); $result = array(); foreach ($res as $r) { $result[] = array('id' => $r['_id']->__toString(), 'label' => $r['tenderNumber'] . ' - ' . $r['title'], 'number' => $r['tenderNumber'], 'value' => $r['title']); } return Response::json($result); }
<?php if (isset($page)) { $page = intval($page); } else { $page = 1; } if (isset($id)) { #获得筹资记录 $thisproject = Project::model()->findByPk($id, "user_id=:user_id", array(":user_id" => Yii::app()->user->getId())); if ($thisproject) { $startlog = ($page - 1) * 15; $thischoujilu = Tender::model()->findAll("project_id=:project_id order by id asc limit :startlog,15 ", array(":project_id" => intval($id), ":startlog" => $startlog)); if ($thischoujilu) { ?> <table class="table table-bordered table-striped"> <tr> <th>序号</th> <th>赞助资金</th> <th>赞助类型</th> <th>用户名</th> <th>赞助时间</th> <th>状态</th> <th>操作</th> </tr> <?php foreach ($thischoujilu as $value) { ?> <tr> <td><?php echo $value->id;
<?php switch ($data['modelName']) { case "Transport": Transport::disableDefaultScope(); $model = Transport::model('Transport')->findByPk($data['key']); echo $this->renderPartial('application.views.transport._view', array('data' => $model)); break; case "Cargo": Cargo::disableDefaultScope(); $model = Cargo::model()->findByPk($data['key']); echo $this->renderPartial('application.views.cargo._view', array('data' => $model)); break; case "Tender": $model = Tender::model()->findByPk($data['key']); echo $this->renderPartial('application.views.tender._view', array('data' => $model)); break; case "User": $model = User::model()->findByPk($data['key']); echo $this->renderPartial('application.views.user._view', array('data' => $model)); break; default: echo "Не правильные данные обратитесь к администратору."; }
<div class="panel-heading qys_panel_heading_title"> <h5 class="panel-title qys_details_panel_title"> <strong>使用记录</strong> </h5> </div> <div class="panel-body"> 暂无记录 </div> </div> </div> </div> </div> </div> <script type="text/javascript"> <?php $thischoujilutotal = Tender::model()->count("project_id=:project_id", array(":project_id" => $oneProject->id)); if ($thischoujilu) { ?> $('#pagination-zhoulog').twbsPagination({ totalPages: <?php echo $thischoujilu ? ceil($thischoujilutotal / 10) : 0; ?> , visiblePages: 1, href: '/project/tenders/id/<?php echo $oneProject->id; ?> /choulog/page/{{number}}.html', onPageClick: function (event, page) { $.ajax({ url: '/project/tenders/id/<?php
<!DOCTYPE html> <html> <head> <?php include 'views/nav.php'; include 'models/tenders.php'; $ten = new Tender($dno); ?> <title>Apply | Tender #<?php echo $dno; ?> </title> <link rel="stylesheet" type="text/css" href="/css/pure.min.css"> <link rel="stylesheet" type="text/css" href="/css/base.css"> </head> <body> <div class="not-nav"> <main> <form class="pure-form pure-form-aligned" method="POST" action="/tenders/<?php echo $dno; ?> "> <legend>Application for Tender #<?php echo $ten->id; ?> : <?php echo $ten->title; ?> </legend> <a href="/tenders/<?php echo $dno;