Tech Programming Ideas is one of the best places on the programming for programmers. Learn coding with Tech Programming Ideas tutorials. We are covered android programming, php, yii2 framework, javascript, mysql, vb.net etc.
Menus
- Home
- PHP
- MySql Tutorials
-
Yii2 Tutorials
- PHP knowledge for studying of Yii framework
- Introduction and requirements for using YII2 Farmework
- Installing Yii
- CRUD Operations code with Gii
- Yii2 Text Input Field
- Yii2 DatePicker
- Yii2 CheckBox
- DropDownList
- Yii2 Dependent Drop Down Lists
- Yii2 Dropdown Multiple Selected
- Yii2 DetailsView Operations
- CheckboxList Advanced Operations
- Yii2 Validation
- Yii2 Validating Input
- Yii2 ListBox Field
- Yii2 Grid View Operations
- Yii2 gridview widget filter
- YII2 Grid View Advanced Options
- YII2 Grid View with Editable column
- Yii2 Gridview with popup
- Importing data from Excel Sheet
- Event Calendar in Yii
- YII2 mPDF
- Yii2 Pjax Tutorial
- Configuration of Layouts, Asset and Theme Integration
- Security
- Role-Based Access Control (RBAC)
- Array of database result to mannually display in table
- Redirect to another action
- Yii2 more useful programming tips
- PHP Programming Tips
- Project developing time faced errors in PHP, MySql, and Apache
-
YII Tutorials II
- Yii Database Operations
- Yii Database Transaction
- Yii Tabular Input
- Yii Masked Input
- Yii Updating Gridview Using Pajax
- Dynamic Forms in Yii2
- Add date picker in dynamic form Yii2
- Getting value form a table using Ajax
- Multiple submit button
- Yii2 Set a where condion for dataprovider
- Change current user password
- Yii2 Usefull Tips
-
Android Tutorials
- Installing Android
- What is Android
- Running a Simple App
- Running State Changing Example
- String Resources
- Transfer Data Between Activities
- Event Handling in Android
- Android Long Press Event
- Show menu items in action bar
- Set icon for android application
- Saving Data With SQLite
- SQLite Database Example
- Android - SQLite Tips
- SQLite reset auto-increment field
- Android Programming Tips
- RadioGroup and RadioButton
- Add a row to the table
- Uninstall Android Studio
- Menu Programs
- Control Statements
-
Android Tutorials
- Splash Screen
- User registration interface
- HTTP GET request
- Android Activity
- Add Two Numbers
- Android Datepicker dialog
- Android Spinner (Drop down list)
- Android Scrolling Text
- Android Download File
- Open Website by Clicking Button
- Android load image from url
- Android WebView
- Create and Display Notification
- EditText dd-mm-yyyy date format
- JS
- Tutorials
Wednesday, 27 December 2017
Thursday, 14 December 2017
How to completely uninstall android studio in ubuntu
Open Terminal
Ctrl + Alt + T
sudo su //login to superuser
Run the following commands in the terminal:
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm -Rf ~/Library/Preferences/com.google.android.*
rm -Rf ~/Library/Preferences/com.android.*
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Caches/AndroidStudio*
rm -Rf ~/.AndroidStudio*
rm -Rf ~/.gradle
rm -Rf ~/.android
rm -Rf ~/Library/Android*
rm -Rf /usr/local/var/lib/android-sdk/
rm -Rf ~/.AndroidStudio*
To delete all projects:
rm -Rf ~/AndroidStudioProjects
Uninstall Android Studio
Monday, 11 December 2017
Yii2 CheckBox
LIKE | COMMENT | SHARE | SUBSCRIBE
LIKE | COMMENT | SHARE | SUBSCRIBE
Yii2 - Display checkbox for boolean database field on active form
<?= $form->field($model, 'mon')->checkBox(['selected' => $model->mon])?>
Change Label
<?= $form->field($model, 'mon')->checkBox(['label'=> 'Monday', 'selected' => $model->mon])?>
Required Checkbox
Add this code your rules function on model class[['mon''], 'compare',
'compareValue' => true,
'operator' => '==',
'message' => "Check to Continue",
'when' => function ($data) {
return $data->mon== 1;
}
],
Example
Model class
<?php
namespace backend\modules\test\models;
use Yii;
/**
* This is the model class for table "studentsdetails".
*
* @property integer $id
* @property string $name
* @property string $address
* @property integer $isverified
*/
class Studentsdetails extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'studentsdetails';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'isverified'], 'required'],
[['isverified'], 'integer'],
[['name'], 'string', 'max' => 300],
[['address'], 'string', 'max' => 500],
[['isverified'], 'compare',
'compareValue' => true,
'operator' => '==',
'message' => "Check to Continue",
'when' => function ($data) {
return $data->isverified== 1;
}
],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Name',
'address' => 'Address',
'isverified' => 'Isverified',
];
}
}
View file
_form.php
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\test\models\Studentsdetails */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="studentsdetails-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'isverified')->checkBox(['selected' => $model->isverified])?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
Sunday, 10 December 2017
Thursday, 7 December 2017
Javascript Tutorials
Convert DD-MM-YYYY to YYYY-MM-DD format using Javascript
var newdate = date.split("-").reverse().join("-");
var dd = 07-12-2017
var x = 30; //days for add
var newdate = dd.split("-").reverse().join("-"); //date convert yyyy-mm-dd
var someDate = new Date(newdate);
someDate.setDate(someDate.getDate() + x); //number of days to add, e.x. x days
var dateFormated = someDate.toISOString().substr(0,10);
var vdate = dateFormated.split("-").reverse().join("-"); //date convert to dd-mm-yyyy
Javascript add number of days to today's date?
var dd = 07-12-2017
var x = 30; //days for add
var newdate = dd.split("-").reverse().join("-"); //date convert yyyy-mm-dd
var someDate = new Date(newdate);
someDate.setDate(someDate.getDate() + x); //number of days to add, e.x. x days
var dateFormated = someDate.toISOString().substr(0,10);
var vdate = dateFormated.split("-").reverse().join("-"); //date convert to dd-mm-yyyy
Sunday, 26 November 2017
VB.NET DataGridView Tutorials
Adding checkbox column to DataGridView
Dim AddColumn As New DataGridViewCheckBoxColumn
With AddColumn
.HeaderText = "ColumnName"
.Name = "Column Name that will be displayed"
.Width = 80
End With
dgAdmin.Columns.Insert(1, AddColumn)
datagridview column header checkbox
Public
Class
search
Private
col As
DataGridViewCheckBoxColumn
Private
chkBox As
CheckBox
Private
Sub
search_Load(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs) Handles
MyBase.Load
col
= New
DataGridViewCheckBoxColumn()
col.Name
= "select"
col.HeaderCell.Style.Alignment
= DataGridViewContentAlignment.MiddleCenter
dgcourse.Columns.Insert(0,
col)
chkBox
= New
CheckBox()
Dim
rect As
Rectangle = dgcourse.GetCellDisplayRectangle(0, -1, True)
chkBox.Size
= New
Size(18, 18)
chkBox.Location
= rect.Location
AddHandler
chkBox.CheckedChanged, AddressOf
chkBox_CheckedChanged
dgcourse.Controls.Add(chkBox)
End
Sub
Private
Sub
chkBox_CheckedChanged(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
'checkbox value change
For
i As
Integer
= 0 To
dgcourse.Rows.Count - 1
dgcourse(0,
i).Value = chkBox.Checked
Next
End
Sub
End
Class
DataGridView - how to hide the “new” row?
Click on datagridview and change properties AllowUserToAddRows set as false.
Programmatically,
myGrid.AllowUserToAddRows = False
Read the checked rows in a datagridview
For
i = 0 To
dgcourse.Rows.Count - 1
If
dgcourse.Rows(i).Cells("select").Value
Then
'dgcourse.Item(1, i).Value
End
If
Next
i
DataGridView1.Rows.Remove(DataGridView1.Rows(x))
Make one column set as editable
Datagridview Readonly Property set as True - all columns are not editable.dataGridView1.Columns("ColumnName").ReadOnly = false;
Wednesday, 22 November 2017
How to send SMS from vb .net application?
This summary is not available. Please
click here to view the post.
Sunday, 29 October 2017
Jquery Tutorials
Jquery Checkbox check all
Html Code
<input type='checkbox' class='checkall' id='check_all_id'>
Jquery
$('#check_all_id').on('click', function(e) {
$('input:checkbox').not(this).prop('checked', this.checked);
});
Thursday, 26 October 2017
Yii2 Gridview with popup
Modal pop up in grid view in yii2
I am going to show you how to implement Gridview with popup.
Insert this code your header section.
Insert this code your header section.
use yii\helpers\Url;
use yii\bootstrap\Modal;
Define modal and Register this JS into you'r index file
Add
Modal
code above GridView
code.<?php
Modal::begin([
'id'
=>
'myModal'
,
'header'
=>
'<h4 class="modal-title">...</h4>'
,
]);
echo
'...'
;
Modal::
end
();
?>
And than register JavaScript at top or bottom of view page.
$this
->registerJs("
$(
'#myModal'
).on(
'show.bs.modal'
,
function
(event) {
var
button = $(event.relatedTarget)
var
modal = $(this)
var
title = button.data(
'title'
)
var
href = button.attr(
'href'
)
modal.find(
'.modal-title'
).html(title)
modal.find(
'.modal-body'
).html(
'<i class=\"fa fa-spinner fa-spin\"></i>'
)
$.post(href)
.done(
function
( data ) {
modal.find(
'.modal-body'
).html(data)
});
})
");
Insert code into gridview column section
return
Html::a(
$count
,[
'detail'
,
'group_id'
=>
$data
->id],[
'data-toggle'
=>
"modal"
,
'data-target'
=>
"#myModal"
,
'data-title'
=>
"Detail Data"
,
]);
Inset code into your controller
return
$this
->renderAjax(
'detail'
, [
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
]);
Yii2 grid with Editable column
Index file
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use backend\modules\tools\models\Groupitems;
use yii\helpers\ArrayHelper;
use backend\modules\tools\models\Center;
use dosamigos\datepicker\DatePicker;
use dosamigos\datepicker\DateRangePicker;
use backend\modules\tools\models\Batch;
use yii\helpers\Url;
use yii\bootstrap\Modal;
$this->title = 'Search Students';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
Modal::begin([
'id' => 'myModal',
'header' => '<h4 class="modal-title">...</h4>',
]);
echo '...';
Modal::end();
$this->registerJs("
$('#myModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget)
var modal = $(this)
var title = button.data('title')
var href = button.attr('href')
modal.find('.modal-title').html(title)
modal.find('.modal-body').html('<i class=\"fa fa-spinner fa-spin\"></i>')
$.post(href)
.done(function( data ) {
modal.find('.modal-body').html(data)
});
})
");
?>
<?php
function getCenter(){
$ccid = Yii::$app->user->identity->ccid;
if(yii::$app->user->can('z-access-all-centers-report'))
{
$x=center::find()->where(['status'=>1])->select(['ccid','subcenter'])->all();
$y=ArrayHelper::map($x,'ccid','subcenter');
//$y[null]='Select All';
return $y;
}
else {
return ArrayHelper::map(center::find()->where(['status'=>1,'ccid'=>$ccid])->all(),'ccid','subcenter');
}
}
?>
<div class="col-xs-12">
<div class="col-lg-8 col-sm-8 col-xs-12 no-padding edusecArLangCss"><h3 class="box-title"><i class="fa fa-th-list"></i> Manage Students</h3></div>
<div class="col-lg-4 col-sm-4 col-xs-12 no-padding" style="padding-top: 20px !important;">
<div class="col-xs-4 left-padding">
</div>
<div class="col-xs-4 left-padding">
</div>
<div class="col-xs-4 left-padding">
<?= Html::a('<i class="fa fa-user"></i> Add Students', ['create'], ['class' => 'btn-sm btn btn-success']) ?>
</div>
</div>
</div>
<div class="students-index box box-body table-responsive">
<!--outside searchabl-->
<?php echo $this->render('_searchstudentsearch', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'columns' => [
[
'header' =>'Sl.No',
'class' => 'yii\grid\SerialColumn',
'options' => ['width' => '50']
],
[
'attribute'=>'ccid',
'content' => function($data){
return Center::getCenter($data->ccid);
},
'options' => ['width' => '120'],
'label'=>'Center',
],
[
'attribute' => 'admission_number',
'label' => 'Add No',
'options' => ['width' => '80']
],
[
'attribute' => 'application_reference_no',
'label' => 'Ref No',
'options' => ['width' => '80']
],
'student_name',
'mobile',
[
'attribute'=>'course_applied',
'content' => function($data){
return Groupitems::getGroupitems($data->course_applied);
},
],
[
'attribute' => 'batch',
'label' => 'Batch',
'options' => ['width' => '80'],
],
[
'attribute'=>'category',
'content' => function($data){
return Groupitems::getGroupitems($data->category);
},
],
[
'format'=>'raw',
'attribute' => 'date_of_join',
'format' => ['date', 'php:d-m-Y'],
'options' => ['width' => '1000'],
],
[
'label'=>'Rem/TotFee',
'value'=> function($data)
{
return Html::a($data->remitted_fee.'/'.$data->total_fee,['students/feedisplay','ccid'=>$data->ccid, 'admission_number' => $data->admission_number],
[
'data-toggle'=>"modal",
'data-target'=>"#myModal",
'data-title'=>"Fee Remitted Details",
]); // ubah ini
},
'format' => 'raw'
],
[
'header'=>'Fee',
'value'=> function($data)
{
return Html::a('<span class="fa fa-inr"></span>', ['receipt/create','addno'=>$data->admission_number]);
},
'format' => 'raw'
],
[
'header'=>'Sales',
'value'=> function($data)
{
$url = Yii::$app->getUrlManager()->createUrl(['stock/stocksales/create','addno'=>$data->admission_number]);
return Html::a('<span class="fa fa-shopping-cart"></span>', $url);
},
'format' => 'raw'
],
[
'class' => 'yii\grid\ActionColumn',
'header' => 'Actions',
'headerOptions' => ['style' => 'color:#337ab7'],
'template' => '{view}{update}', //yii::$app->user->can('update-students') ? '{view}{update}':'{view}',
'contentOptions' => ['style' => 'width:70px;'],
],
],
]); ?>
</div>
Controller file
public function actionFeedisplay($ccid,$admission_number){
// Code here...
return $this->renderAjax('studentsearch_fee.php',['dataFee'=>$dataFee]);
}
Related Links
DropDownList
Yii2 Dependent Drop Down Lists
CheckboxList Advanced Operations
Yii2 ListBox Field
Subscribe to:
Posts (Atom)