Help create jquery album

Help create jquery album

I make jQuery but I have not seen jquery

it is my customController

  1. public function actionGetgallery()
  2. {
  3. $usersId = isset($_POST['usersId'])?$_POST['usersId']:'';
  4. Yii::app()->user->setState('dash_usersId', $usersId);

  5. echo json_encode('yes');
  6. return;
  7. }

  8. public function actionGetImage()
  9. {
  10. $sql = ' SELECT a.picture AS picture, c.username, e.name FROM activity a JOIN usersorganization b ';
  11. $sql .= 'ON a.users_organization_id = b.users_organization_id ';
  12. $sql .= 'JOIN users c ON b.users_id = c.users_id ';
  13. $sql .= 'JOIN clientorganization d ON b.client_organization_id = d.client_organization_id ';
  14. $sql .= ' JOIN organization e ON d.organization_id = e.organization_id ORDER BY activity_id DESC';
  15. // $sql =' SELECT a.picture AS picture, d.name AS name FROM activity a JOIN usersorganization b ON a.users_organization_id = b.users_organization_id JOIN clientorganization c ON b.client_organization_id = c.client_organization_id JOIN organization d ON c.organization_id = d.organization_id ORDER BY activity_id DESC ';

  16. $dataProvider = new CSqlDataProvider(
  17. $sql,array(
  18. 'keyField' => 'picture',
  19. )
  20. );

  21. foreach($dataProvider->getData() AS $i=>$ii)
  22. // echo var_dump($ii);
  23. {
  24. $gambar = array();
  25. echo '<div class="superbox-list img1"><table border="2" color="black">
  26. <tr>
  27. <td><img class="superbox-img" src="'.$gambar[$i] = (int)$ii['picture'].'"/></td></tr><center>
  28. <tr><td><h5>'.$gambar[$i] = (int)$ii['name'].'</center></h5></td></tr></table>
  29. </div>';
  30. }
  31. echo json_encode($gambar);
  32. return;
  33. }

and this my views

  1. <script type="text/javascript">

  2. var Imgx = $("#image").val();

  3. $(document).ready(function() 
  4. {
  5. getImgx();
  6. });

  7. function setProgr()
  8. {
  9. var e = document.getElementById("users_id");
  10. var usersId = e.options[e.selectedIndex].value;

  11. var uri = '<?php 
  12. echo Yii::app()->createAbsoluteUrl("Custom/Getgallery"); 
  13. ?>';
  14. jQuery.ajax(
  15. {
  16. type: 'POST',
  17. async: false,
  18. dataType: "json",
  19. url: uri,
  20. data: {usersId:usersId},
  21. success: function(result) 
  22. {
  23. getImgx();
  24. // alert(getImgx);
  25. }
  26. });
  27. }

  28. function getImgx()
  29. {
  30. var e = document.getElementById("users_id");
  31. var usersId = e.options[e.selectedIndex].value;

  32. var uri = '<?php echo Yii::app()->createAbsoluteUrl("Custom/GetImage"); ?>';
  33. jQuery.ajax(
  34. {
  35. type: 'POST',
  36. async: false,
  37. dataType: "json",
  38. url: uri,
  39. data: {usersId:usersId},
  40. success: function(result) 
  41. {
  42. alert(Imgx);
  43. Imgx = result;
  44. }
  45. });
  46. }

  47. </script>