annotate app/controllers/icon_controller.php @ 3:7201fd354bdf

added icon features , default icon
author Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
date Sun, 14 Aug 2011 23:52:31 +0900
parents
children c3adb28473d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 <?php
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 class IconController extends AppController
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 {
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 public $name = "icon";
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 public $autoRender = false;
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 public $uses = null;
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 public function index()
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 {
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 $icon_dir = "../icon"; //relative path without slash
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 $this->autoRender = false;
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 $icon_default = "/default.png"; //file name must include slash
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 $icon_file = $icon_default;
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 if(isset($this->params["url"]["uuid"])){
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 $icon_file = "/".$this->params["url"]["uuid"]."png";
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 }
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 $icon = @file_get_contents($icon_dir.$icon_file);
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 if($icon === FALSE){
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 //failed to get icon
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 $icon = file_get_contents($icon_dir.$icon_default);
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 }
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 header("Content-Type: image/png");
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 print($icon);
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 }
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 public function EditIcon()
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 {
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 }
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 public function SaveIcon()
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 {
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 }
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 }
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
7201fd354bdf added icon features , default icon
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 ?>