- /.modal - gt;
lt;/div gt;
lt; script gt; edit_teacher ($ this)
{
$ ( # id_ ). val ($ ($ this) .parent (). children ( .id ). val ());
$(laquo;#name_raquo;).val($($this).parent().parent()ildren(laquo;.nameraquo;).text());
$(laquo;#surname_raquo;).val($($this).parent().parent()ildren(laquo;.surnameraquo;).text());
$(laquo;#lastname_raquo;).val($($this).parent().parent()ildren(laquo;.lastnameraquo;).text());
$(laquo;#experience_raquo;).val($($this).parent().parent()ildren(laquo;.experienceraquo;).text());
$(laquo;#category_raquo;).val($($this).parent().parent()ildren(laquo;.categoryraquo;).text());
$(laquo;#subject_raquo;).val($($this).parent().parent()ildren(laquo;.subjectraquo;)tr(laquo;idraquo;));
} send_change ()
{
$ id=$ ( # id_ ). val ();
$ name=$ ( # name_ ). val ();
$ surname=$ ( # surname_ ). val ();
$ lastname=$ ( # lastname_ ). val ();
$ experience=$ ( # experience_ ). val ();
$ category=$ ( # category_ ). val ();
$ subject=$ ( # subject_ ). val ();
$. post ( lt;?=URL. ajax_admin/save_teacher laquo ;;? gt; raquo ;, { id raquo ;: $ id, name raquo ;: $ name, surname raquo ;: $ surname, lastname raquo ;: $ lastname, experience raquo ;: $ experience, category raquo ;: $ category, subject raquo ;: $ subject}, function (data) {($ ( laquo ; # id_ ). val ()!=- 1)
{
$ tr=$ ( # teacher_ + $ id);
$ trildren ( .name ). text ($ name);
$ trildren ( .surname ). text ($ surname);
$ trildren ( .lastname ). text ($ lastname);
$ trildren ( .experience ). text ($ experience);
$ trildren ( .category ). text ($ category);
$ trildren ( .subject ). attr ( id raquo ;, $ subject);
$ trildren ( .subject ). text ($ ( #subject_ option: selected ). text ());
} else if ($ .isNumeric (data)) {
$ ( # subjects_cont ). append ($ ( lt; tr id= teacher_ + $ id + gt; +
' lt; td gt;
' lt; td gt;
' lt; td gt;
' lt; td gt;
' lt; td gt;
lt; td id= + $ Subject + ' gt;
' lt; td width= 200 gt; lt; input type= hidden gt;
' lt; button type= button gt;
' lt; button type= button gt;
lt;/td gt; +
lt;/tr gt; ));
}
});
$ ( # addTeacher ). click ();
} clean_form () {
$ ( # id_ ). val (- 1);
$ ( # name_ ). val ( );
$ ( # surname_ ). val ( );
$ ( # experience_ ). val ( );
$ ( # category_ ). val ( );
$ ( # lastname_ ). val ( );
$ ( # category_ ). val ( );
$ ( # subject_ ). val ( );
} remove_teacher ($ this) {
$ id=$ ($ this) .parent (). children ( .id ). val ();
$. post ( lt;?=URL. ajax_admin/delete_teacher laquo ;;? gt; raquo ;, { id raquo ;: $ id}, function (data) {
$ ( # teacher_ + $ id) .remove ();
});
}
$ (document) .ready (function () {
$ ( # table ). tablesorter ({: {3: {sorter: false}}});
});
lt;/script gt;
Додаток Г
(Контролер)
Папка: controllers
Файли: .php.php.php.php
Файл: admin.php
lt;? phpadmin extends controller
{function __construct ()
{:: __ construct ();
} index ()
{:: handleLogin (); ( location: raquo ;. URL. admin/teachers );
} subjects ()
{:: handleLogin ();
$ this- gt; view- gt; subjects=$ this- gt; ...