miércoles, 29 de noviembre de 2017
sábado, 4 de noviembre de 2017
Tareas en Linux
- file management
- Process management
- user management
- permission management
- services management
- software management
- log monitoreing
domingo, 15 de octubre de 2017
Uso de between en active record yii2
$resultado = app\modules\ventas\models\Ordenes::find()->where(['between', 'fecha_reg', "$fecha1", "$fecha2" ])->all();
miércoles, 11 de octubre de 2017
Query find con join
$resultado = OrdenesDetalle::find()
->joinWith('datos')
// ->onCondition(['>', 'existencia', 0])
->where(['=', 'id_orden', $id])
->all();
<td><?=$value->datos->nombre?></td>
->joinWith('datos')
// ->onCondition(['>', 'existencia', 0])
->where(['=', 'id_orden', $id])
->all();
<td><?=$value->datos->nombre?></td>
domingo, 10 de septiembre de 2017
querys con and or
$model = arname()->find()
->andWhere(['user_id'=>[1,5,8]])
->andWhere(['or',
['status'=>1],
['verified'=>1]
])
->orWhere(['and',
['social_account'=>1],
['enable_social'=>1]
])
->all();
miércoles, 12 de julio de 2017
Fuente para web
https://fonts.google.com/
https://www.fontsquirrel.com/tools/webfont-generator
http://fontpair.co/
Generar Iconos
http://www.favicon-generator.org/
http://realfavicongenerator.net/
http://www.favicon.cc/
http://realfavicongenerator.net/
http://www.favicon.cc/
Instalar Barkets
https://geekytheory.com/instalar-brackets-editor-libre-html-css-y-javascript-en-ubuntu
sudo add-apt-repository ppa:webupd8team/brackets
sudo apt-get update
sudo apt-get install brackets
viernes, 7 de julio de 2017
Diferentes querys para usar en yii2
Funcion SUM
<?=app\modules\soporte\models\InvBaterias::find()->where(['id_periodo'=>1])->sum('cantidad');
Funcion orderBy
$resultado = CatPlanteles::find()->orderBy('id')->all();
app\modules\admin\models\EstadoBaja::find()->orderBy('nombre')->asArray()->all()
Funcion Count
<?=app\modules\soporte\models\InvImpresoras::find()->where(['id_plantel'=>$value['id']])->andWhere(['estado'=>1])->count(); ?>
Función group by
InvNobreak::find()->select(['marca'])->where(['id_plantel'=>Yii::$app->user->identity->id_plantel])->groupBy(['marca'])->all();
Funcion queryOne como arreglo
\Yii::$app->db2->createCommand($sql)->queryOne();
$var['var'];
Funcion find ONE
$model = InvBajas::findOne($id_baja);
$model->progresivo;
$model->tipoEquipo->nombre;
$inventario = \Yii::$app->db2->createCommand($sql)->queryOne();
<?=app\modules\soporte\models\InvBaterias::find()->where(['id_periodo'=>1])->sum('cantidad');
Funcion orderBy
$resultado = CatPlanteles::find()->orderBy('id')->all();
app\modules\admin\models\EstadoBaja::find()->orderBy('nombre')->asArray()->all()
Funcion Count
<?=app\modules\soporte\models\InvImpresoras::find()->where(['id_plantel'=>$value['id']])->andWhere(['estado'=>1])->count(); ?>
Función group by
InvNobreak::find()->select(['marca'])->where(['id_plantel'=>Yii::$app->user->identity->id_plantel])->groupBy(['marca'])->all();
Funcion queryOne como arreglo
\Yii::$app->db2->createCommand($sql)->queryOne();
$var['var'];
Funcion find ONE
$model = InvBajas::findOne($id_baja);
$model->progresivo;
$model->tipoEquipo->nombre;
$inventario = \Yii::$app->db2->createCommand($sql)->queryOne();
domingo, 18 de junio de 2017
Graficos en yii2
agregar al composer
"miloschuman/yii2-highcharts-widget": "dev-master",
<?php
use yii\helpers\Html;
use miloschuman\highcharts\Highcharts;
use yii\web\JsExpression;
/*use app\modules\student\models\StuMaster;
use \app\modules\course\models\Batches;
$this->title = Yii::t('course', 'Manage Course Modules');
$this->params['breadcrumbs'][] = $this->title;
$this->registerCss(".disp-count{cursor:default;} .disp-count:hover {background-color:none !important}");*/
?>
<?php
echo Highcharts::widget([
'scripts' => [
'modules/exporting',
'themes/grid-light',
'highcharts-3d',
],
'options' => [
'exporting'=>[
'enabled'=>true
],
'credits'=>[
'enabled'=>false
],
'chart'=> [
'type'=>'pie',
],
'title' => ['text' => 'Fruit Consumption'],
'xAxis' => [
'categories' => ['Apples', 'Bananas', 'Oranges']
],
'yAxis' => [
'title' => ['text' => 'Fruit eaten']
],
'series' => [
['name' => 'Jane', 'data' => [1, 0, 4]],
['name' => 'John', 'data' => [5, 7, 3]]
]
]
]);
?>
"miloschuman/yii2-highcharts-widget": "dev-master",
<?php
use yii\helpers\Html;
use miloschuman\highcharts\Highcharts;
use yii\web\JsExpression;
/*use app\modules\student\models\StuMaster;
use \app\modules\course\models\Batches;
$this->title = Yii::t('course', 'Manage Course Modules');
$this->params['breadcrumbs'][] = $this->title;
$this->registerCss(".disp-count{cursor:default;} .disp-count:hover {background-color:none !important}");*/
?>
<?php
echo Highcharts::widget([
'scripts' => [
'modules/exporting',
'themes/grid-light',
'highcharts-3d',
],
'options' => [
'exporting'=>[
'enabled'=>true
],
'credits'=>[
'enabled'=>false
],
'chart'=> [
'type'=>'pie',
],
'title' => ['text' => 'Fruit Consumption'],
'xAxis' => [
'categories' => ['Apples', 'Bananas', 'Oranges']
],
'yAxis' => [
'title' => ['text' => 'Fruit eaten']
],
'series' => [
['name' => 'Jane', 'data' => [1, 0, 4]],
['name' => 'John', 'data' => [5, 7, 3]]
]
]
]);
?>
Actualizar composer yii2
sudo composer global require fxp/composer-asset-plugin:~1.3@dev
martes, 23 de mayo de 2017
Poner un estilo a GridView
[
'attribute'=>'estado_baja',
'value' => 'estadoBaja.nombre',
'contentOptions' => function($model)
{
return ['style' => 'color:' . $model->estadoBaja->color];
},
'filter' => yii\helpers\ArrayHelper::map(app\modules\admin\models\EstadoBaja::find()->orderBy('nombre')->asArray()->all(),'id','nombre')
],
'attribute'=>'estado_baja',
'value' => 'estadoBaja.nombre',
'contentOptions' => function($model)
{
return ['style' => 'color:' . $model->estadoBaja->color];
},
'filter' => yii\helpers\ArrayHelper::map(app\modules\admin\models\EstadoBaja::find()->orderBy('nombre')->asArray()->all(),'id','nombre')
],
miércoles, 17 de mayo de 2017
Escenarios en Yii2
Se crea el escenario en el modelo en la funcion rules
[['usuario', 'id_area', 'id_piso'], 'required', 'on'=>'upuser'],
y en el controlador
si es update
$model = $this->findModel($id);
$model->scenario = 'upuser';
Si es insert
$model = new InvEquipos(['scenario'=>'upuser']);
[['usuario', 'id_area', 'id_piso'], 'required', 'on'=>'upuser'],
y en el controlador
si es update
$model = $this->findModel($id);
$model->scenario = 'upuser';
Si es insert
$model = new InvEquipos(['scenario'=>'upuser']);
martes, 25 de abril de 2017
Crear relaciones entre modelos
use app\modules\soporte\models\CatAntiguedad;
public function getCatAntiguedad()
{
return $this->hasOne(CatAntiguedad::className(),['id'=>'clasif']);
}
Para mandar llamarla relacion es por medio
<?= $model->catAntiguedad->nombre ?>
public function getCatAntiguedad()
{
return $this->hasOne(CatAntiguedad::className(),['id'=>'clasif']);
}
Para mandar llamarla relacion es por medio
<?= $model->catAntiguedad->nombre ?>
Dropdownlist Dependientes yii2
<div class="form-group">
<label for="curl" class="control-label col-lg-2">Marca</label>
<div class="col-lg-4">
<?= $form->field($model, 'marca', ['inputOptions'=>[ 'class'=>'form-control', 'placeholder' => 'tipo'] ] )->dropDownList(ArrayHelper::map(app\modules\soporte\models\CatMarca::find()->orderBy(['id'=>SORT_ASC])->all(),'id','nombre'),
[
'prompt'=>Yii::t('app', '--- Selecciona Marca ---'),
'onchange'=>'
$.post( "'.Yii::$app->urlManager->createUrl('soporte/inv-equipos/modelos?id=').'"+$(this).val(), function( data ) {
$( "select#invequipos-modelo" ).html( data );
});
'])->label(false); ?>
</div>
</div>
<div class="form-group">
<label for="ccomment" class="control-label col-lg-1">Modelo</label>
<div class="col-lg-4">
<?= $form->field($model, 'modelo', ['inputOptions'=>[ 'class'=>'form-control', 'placeholder' => 'modelo'] ] )->dropDownList(ArrayHelper::map(app\modules\soporte\models\CatModelo::find()->orderBy(['id'=>SORT_ASC])->all(),'id','modelo'),['prompt'=>Yii::t('app', '--- Selecciona modelo ---')])->label(false); ?>
</div>
</div>
----Action--
public function actionModelos($id)
{
$cuentaModelos = CatModelo::find()->where(['id'=>$id])->count();
$modelos = CatModelo::find()->where(['id'=>$id])->all();
if ($cuentaModelos > 0) {
foreach ($modelos as $key => $value) {
echo "<option value=". $value->id . ">". $value->modelo. "</option>";
}
}else{
echo "<option>-</option>";
}
}
<label for="curl" class="control-label col-lg-2">Marca</label>
<div class="col-lg-4">
<?= $form->field($model, 'marca', ['inputOptions'=>[ 'class'=>'form-control', 'placeholder' => 'tipo'] ] )->dropDownList(ArrayHelper::map(app\modules\soporte\models\CatMarca::find()->orderBy(['id'=>SORT_ASC])->all(),'id','nombre'),
[
'prompt'=>Yii::t('app', '--- Selecciona Marca ---'),
'onchange'=>'
$.post( "'.Yii::$app->urlManager->createUrl('soporte/inv-equipos/modelos?id=').'"+$(this).val(), function( data ) {
$( "select#invequipos-modelo" ).html( data );
});
'])->label(false); ?>
</div>
</div>
<div class="form-group">
<label for="ccomment" class="control-label col-lg-1">Modelo</label>
<div class="col-lg-4">
<?= $form->field($model, 'modelo', ['inputOptions'=>[ 'class'=>'form-control', 'placeholder' => 'modelo'] ] )->dropDownList(ArrayHelper::map(app\modules\soporte\models\CatModelo::find()->orderBy(['id'=>SORT_ASC])->all(),'id','modelo'),['prompt'=>Yii::t('app', '--- Selecciona modelo ---')])->label(false); ?>
</div>
</div>
----Action--
public function actionModelos($id)
{
$cuentaModelos = CatModelo::find()->where(['id'=>$id])->count();
$modelos = CatModelo::find()->where(['id'=>$id])->all();
if ($cuentaModelos > 0) {
foreach ($modelos as $key => $value) {
echo "<option value=". $value->id . ">". $value->modelo. "</option>";
}
}else{
echo "<option>-</option>";
}
}
Suscribirse a:
Entradas (Atom)