Skip to content

Instantly share code, notes, and snippets.

View nsanden's full-sized avatar

Nate Sanden nsanden

View GitHub Profile
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
'gii'=>'gii',
'gii/<controller:\w+>'=>'gii/<controller>',
'gii/<controller:\w+>/<action:\w+>'=>'gii/<controller>/<action>',
<script>
$(document).ready(function() {
var triggers = $(".modalInput").overlay({
// some mask tweaks suitable for modal dialogs
mask: {
color: '#000',
loadSpeed: 0,
opacity: 0.7
},
public function testGetVotedFor()
{
$contestant1 = new stdClass;
$contestant1->name = 'Michael Jordan';
$contestant1->id = 1;
$contestant2 = new stdClass;
$contestant2->name = 'Patrick Ewing';
$contestant2->id = 2;
$comment['message'] = 'I really like Michael Jordan';
$this-assertEquals(getVotedFor($comment, $contestant1, $contestant2), 1);
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'label' => 'title',
'format' => 'html',
'value' => function () { return Html::a($owner->model->title, 'site/index'); }
],
'pay',
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
/**
* This is the model class for table "tbl_job".
<?php
namespace backend\controllers;
use Yii;
use common\models\Job;
use common\models\JobSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
$criteria = new CDbCriteria(array(
'condition' => '`'.$this->orderField.'` > :position' . ($this->condition ? ' AND ' . $this->condition : ''),
'params' => array(':position' => $this->owner->attributes[$this->orderField]),
'order' => '`'.$this->orderField.'`',
));
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/**
* @var yii\web\View $this
* @var common\models\cList $model
*/