Exemplo n.º 1
0
 /**
  * Page qui affiche les choix pour le material
  *
  * @return  void
  */
 public function listing_material()
 {
     $this->auto_render = FALSE;
     if (!request::is_ajax()) {
         return FALSE;
     }
     $v = new View('editor/material');
     $v->material = file::listing_dir(DOCROOT . 'images/background/');
     $v->render(TRUE);
 }
Exemplo n.º 2
0
 /**
  * Methode : génération du fichier JS
  */
 public function compileJs()
 {
     header('Content-type: text/javascript');
     $display = null;
     foreach (file::listing_dir(DOCROOT . 'js/class') as $row) {
         if (is_file(DOCROOT . 'js/class/' . $row)) {
             $display .= implode('', file(DOCROOT . 'js/class/' . $row)) . "\n";
         }
     }
     $display .= implode('', file(DOCROOT . 'js/map.js')) . "\n";
     $this->auto_render = FALSE;
     echo $display;
 }
Exemplo n.º 3
0
 /**
  * Methode :
  */
 public function vignette($img = false)
 {
     $this->auto_render = FALSE;
     if (!request::is_ajax()) {
         return FALSE;
     }
     $v = new View('formulaire/vignette');
     $v->images = file::listing_dir(DOCROOT . '../images/modules');
     $v->selected = $img;
     $v->module = 'modules';
     $v->width = 96;
     $v->height = 96;
     $v->render(true);
 }
Exemplo n.º 4
0
 /**
  * Methode : affiche le formulaire en overlay pour edit
  */
 public function form($id_region, $x, $y, $z)
 {
     $this->auto_render = FALSE;
     if (!request::is_ajax()) {
         return;
     }
     $view = new View('mapping/form');
     $view->x = $x;
     $view->y = $y;
     $view->z = $z;
     $view->region_id = $id_region;
     $view->type = 'add';
     if ($view->row = Map_Model::instance()->select(array('region_id' => $id_region, 'x' => $x, 'y' => $y, 'z' => $z, 'module_map IS NOT' => NULL), 1)) {
         $view->type = 'edit';
         $view->id = $view->row->id;
         if ($view->row->action_map) {
             $view->row = unserialize($view->row->action_map);
         }
     }
     $view->actions = file::listing_dir(MODPATH . '/plugins/views');
     $view->render(true);
 }
Exemplo n.º 5
0
 /**
  * Méthode :
  */
 public function index(&$view)
 {
     $view->sounds = file::listing_dir(DOCROOT . '../audios');
 }
Exemplo n.º 6
0
 /**
  * Page qui affiche les avatars pour modifier
  * 
  * @return  void
  */
 public function listing_avatar()
 {
     $this->auto_render = FALSE;
     if (!request::is_ajax()) {
         return FALSE;
     }
     $v = new View('users/avatar');
     $v->avatar = file::listing_dir(DOCROOT . '../images/character/');
     $v->render(TRUE);
 }
Exemplo n.º 7
0
 /**
  * Générer un JSON
  *
  * @return void
  */
 public function index($render = TRUE)
 {
     $json = new View('map/json');
     $json->my = $this->user;
     if (!($this->region = Region_Model::instance()->select(array('id' => $this->user->region_id), 1))) {
         return FALSE;
     }
     $json->items = Item_Model::instance()->select();
     $elements = $modules = $items = FALSE;
     if (($rows = Map_Model::instance()->select(array('region_id' => $this->region->id), FALSE)) !== FALSE) {
         $prenoms = Name_Model::instance()->select();
         $listName = array();
         foreach ($prenoms as $prenom) {
             $listName[] = ucfirst(mb_strtolower($prenom->prenom));
         }
         $images = file::listing_dir(DOCROOT . 'images/character');
         foreach ($rows as $row) {
             if (!$row->module_map && !$row->bot) {
                 $elements[] = '{"x" : ' . $row->x . ', "z" : ' . $row->z . ', "y" : ' . $row->y . ', "subX" : ' . $row->subX . ', "subZ" : ' . $row->subZ . ', "subY" : ' . $row->subY . ', "materials" : [ "' . $row->background_px . '", "' . $row->background_nx . '", "' . $row->background_py . '", "' . $row->background_ny . '", "' . $row->background_pz . '", "' . $row->background_nz . '"	] }';
             } else {
                 $data = @unserialize($row->action_map);
                 $action = json_encode($data);
                 if ($row->module_map == 'article') {
                     $article = Article_Model::instance()->select(array('id_article' => $data->id_article, 'article_category_id' => 2, 'status' => 1), 1);
                     $modules[] = '{"x" : ' . $row->x . ', "z" : ' . $row->z . ', "y" : ' . $row->y . ', "subX" : ' . $row->subX . ', "subZ" : ' . $row->subZ . ', "subY" : ' . $row->subY . ', "data" : ' . $action . ', "article" : ' . json_encode($article->article) . ' }';
                 } elseif ($row->bot) {
                     $v = new stdClass();
                     $v->id = 0;
                     $v->name = $row->bot ? $row->title : $listName[array_rand($listName)];
                     $v->x = $row->x;
                     $v->y = $row->y;
                     $v->z = $row->z;
                     $v->region_id = $row->region_id;
                     $v->user_id = $this->user->id;
                     if ($row->bot == 2) {
                         $v->image = 'animals/bears.png';
                     } elseif ($row->bot == 3) {
                         $v->image = 'animals/dog.png';
                     } else {
                         $v->image = 'character/' . $images[array_rand($images)];
                     }
                     $v->hp_max = 100;
                     $v->hp = 100;
                     $v->leak = 0;
                     $v->type = $row->bot;
                     $v->fixe = $row->bot && !$row->module_map ? 0 : 1;
                     $v->argent = 1000;
                     $v->xp = 10;
                     $v->niveau = 0;
                     $this->botFixe[] = $v;
                     if ($row->module_map == 'quete') {
                         $modules[] = '{"x" : ' . $row->x . ', "z" : ' . $row->z . ', "y" : ' . ($row->y - 1) . ', "subX" : ' . $row->subX . ', "subZ" : ' . $row->subZ . ', "subY" : ' . $row->subY . ', "data" : ' . $action . ', "article" : "" }';
                     }
                 } else {
                     $modules[] = '{"x" : ' . $row->x . ', "z" : ' . $row->z . ', "y" : ' . ($row->y - 1) . ', "subX" : ' . $row->subX . ', "subZ" : ' . $row->subZ . ', "subY" : ' . $row->subY . ', "data" : ' . $action . ', "article" : "" }';
                 }
             }
         }
     }
     $articles = Article_Model::instance()->select(array('region_id' => $this->region->id, 'article_category_id' => 2, 'status' => 1));
     $articlesList = null;
     if ($articles) {
         foreach ($articles as $row) {
             $articlesList[] = json_encode($row->reponse ? $row->article . '<div class="reponse">' . $row->reponse . '</div>' : $row->article);
         }
     }
     $this->region->map = new stdClass();
     $this->region->map->region = $this->region;
     $this->region->map->elements = $elements ? implode(',', $elements) : FALSE;
     $this->region->map->modules = $modules ? implode(',', $modules) : FALSE;
     $this->region->map->articles = $articlesList ? implode(',', $articlesList) : FALSE;
     $this->region->map->region->bots = $this->botFixe;
     $json->region = $this->region;
     $sounds = file::listing_dir(DOCROOT . 'audios', array('home.mp3'));
     $json->sounds = $sounds ? json_encode($sounds) : FALSE;
     return $json->render($render);
 }
Exemplo n.º 8
0
 /**
  * Methode :
  */
 private function vignette_global($img, $dossier, $x, $y)
 {
     $this->auto_render = FALSE;
     if (!request::is_ajax()) {
         return FALSE;
     }
     $v = new View('formulaire/vignette');
     $v->images = file::listing_dir(DOCROOT . '../images/' . $dossier);
     $v->selected = $img;
     $v->class = $dossier;
     $v->module = $dossier;
     $v->width = $x;
     $v->height = $y;
     $v->render(true);
 }