assignments.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * assignments.php
  4. *
  5. * @author Spyros Soldatos <spyros@valor.gr>
  6. * @link http://code.google.com/p/srbac/
  7. */
  8. /**
  9. * The view of the users assignments
  10. * If no user id is passed a drop down with all users is shown
  11. * Else the user's assignments are shown.
  12. *
  13. * @author Spyros Soldatos <spyros@valor.gr>
  14. * @package srbac.views.authitem
  15. * @since 1.0.1
  16. */
  17. ?>
  18. <?php $this->breadcrumbs = array(
  19. 'Srbac Assignments'
  20. )
  21. ?>
  22. <?php if($this->module->getMessage() != ""){ ?>
  23. <div id="srbacError">
  24. <?php echo $this->module->getMessage();?>
  25. </div>
  26. <?php } ?>
  27. <?php if(!$id) {
  28. if($this->module->getShowHeader()) {
  29. $this->renderPartial($this->module->header); }
  30. ?>
  31. <div class="simple">
  32. <?php
  33. $this->renderPartial("frontpage");
  34. ?>
  35. <?php echo SHtml::beginForm(); ?>
  36. <?php echo SHtml::activeDropDownList($this->module->getUserModel(),$this->module->userid,
  37. SHtml::listData($this->module->getUserModel()->findAll(), $this->module->userid, $this->module->username),
  38. array('size'=>1,'class'=>'dropdown','ajax' => array(
  39. 'type'=>'POST',
  40. 'url'=>array('showAssignments'),
  41. 'update'=>'#assignments',
  42. 'beforeSend' => 'function(){
  43. $("#assignments").addClass("srbacLoading");
  44. }',
  45. 'complete' => 'function(){
  46. $("#assignments").removeClass("srbacLoading");
  47. }'
  48. ),
  49. 'prompt'=>Helper::translate('srbac','select user')
  50. )); ?>
  51. <?php echo SHtml::endForm(); ?>
  52. </div>
  53. <?php } else { ?>
  54. <?php $url = Yii::app()->urlManager->createUrl("srbac/authitem/showAssignments",array("id"=>$id));?>
  55. <?php Yii::import("srbac.components.Helper");?>
  56. <?php Helper::publishCss(Yii::app()->getModule('srbac')->css,true);?>
  57. <?php Yii::app()->clientScript->registerScript(
  58. "alert",
  59. "$.ajax({
  60. type: 'POST',
  61. url: '".$url."',
  62. success: function(html){
  63. $('#assignments').html(html);
  64. }
  65. });
  66. ",
  67. CClientScript::POS_READY
  68. ); ?>
  69. <?php } ?>
  70. <div id="assignments">
  71. </div>
  72. <?php if(!$id) {?>
  73. <?php if($this->module->getShowFooter()) {
  74. $this->renderPartial($this->module->footer);
  75. }?>
  76. <?php }?>