source: lliurex-jocomunico/trunk/fuentes/lliurex-jocomunico.install/var/lib/application/models/ImgUploader_model.php @ 5728

Last change on this file since 5728 was 5728, checked in by joamuran, 3 years ago

Added zero-installed and updated jocomunico

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1<?php
2
3class ImgUploader_model extends CI_Model {
4
5    function __construct() {
6        // Call the Model constructor
7        parent::__construct();
8    }
9
10    function insertImg($idusu, $orgiginalName, $md5Name, $path) {
11        $data = array(
12            'ID_ISU' => $idusu,
13            'imgName' => $orgiginalName,
14            'imgPath' => $path.$md5Name
15        );
16
17        $this->db->insert('Images', $data);
18    }
19
20    function getImages($idusu, $name) {
21        $output = array();
22
23        $this->db->limit(6);
24        $this->db->where('ID_ISU', $idusu);
25        $this->db->like('imgName', $name, 'after');
26        $this->db->order_by('imgName', 'asc');
27        $query = $this->db->get('Images');
28
29        if ($query->num_rows() > 0) {
30            $output = $query->result_array();
31        }
32
33        return $output;
34    }
35
36    function getImagesArasaac($idusu, $name, $languageInt) {
37        //Interface language
38       
39
40        $output = array();
41
42        $this->db->limit(6); // limit up to 6
43
44        $this->db->where_in('Pictograms.ID_PUser', array('1', $idusu));
45        $this->db->where('PictogramsLanguage.languageid', $languageInt);
46        //$this->db->or_where_in('Pictograms.ID_PUser', array('1',$user)); //Get all default and own user pictos
47        $this->db->select('PictogramsLanguage.pictotext as imgName, imgPicto as imgPath, Pictograms.ID_PUser'); // rename the field like we want
48        $this->db->like('PictogramsLanguage.pictotext', $name, 'after'); // select only the names that start with $startswith
49        $this->db->order_by('PictogramsLanguage.pictotext', 'asc'); // order the names
50         $this->db->join('PictogramsLanguage', 'PictogramsLanguage.pictoid = Pictograms.pictoid', 'left');
51        $query = $this->db->get('Pictograms'); // execute de query
52
53        if ($query->num_rows() > 0) {
54            $output = $query->result_array();
55        }
56        return $output;
57    }
58
59}
Note: See TracBrowser for help on using the repository browser.