Skip to content

Instantly share code, notes, and snippets.

@dvidsilva
Created August 14, 2013 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvidsilva/6227756 to your computer and use it in GitHub Desktop.
Save dvidsilva/6227756 to your computer and use it in GitHub Desktop.
<?php
public function rules()
{
return array(
array('roleid', 'verificarCodigo'),
);
}
public function verifyCupos($attribute_name,$params)
{
if(!isset( $_POST['modelname']) ){
return true;
}
$q = "
seleccionar codigo que quieras
";
$alr = Yii::app()->db->createCommand($q)->queryAll();
if( isset( $cp[0]['cupos'] ) && $cp[0]['cupos'] > 0 && $cp[0]['cupos'] <= $alr[0]['total'] ){
$this->addError('userid',
'El codigo : '.$this->context->course->fullname.' ya paila ' );
return false;
}
return true;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment