Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 3674
Línea 69... Línea 69...
69
        return $record;
69
        return $record;
70
    }
70
    }
Línea 71... Línea 71...
71
    
71
    
72
    /**
72
    /**
-
 
73
     *
-
 
74
     * @param string $code
-
 
75
     * @param int $network_id
-
 
76
     * @return  Page
-
 
77
     */
-
 
78
    public function fetchOneByCodeAndNetworkId($code, $network_id)
-
 
79
    {
-
 
80
        $prototype = new Page();
-
 
81
        $select = $this->sql->select(self::_TABLE);
-
 
82
        $select->where->equalTo('code', $code);
-
 
83
        $select->where->equalTo('network_id', $network_id);
-
 
84
        $select->limit(1);
-
 
85
        
-
 
86
        $record = $this->executeFetchOneObject($select, $prototype);
-
 
87
        if($record && $record->content) {
-
 
88
            $record->content = html_entity_decode($record->content);
-
 
89
        }
-
 
90
        return $record;
-
 
91
    }
-
 
92
    
-
 
93
    /**
73
     *
94
     *
-
 
95
     * @param string $search
74
     * @param string $search
96
     * @param int $network_id
75
     * @param int $page
97
     * @param int $page
76
     * @param int $records_per_page
98
     * @param int $records_per_page
77
     * @param string $order_field
99
     * @param string $order_field
78
     * @param string $order_direction
100
     * @param string $order_direction
79
     * @return Paginator
101
     * @return Paginator
80
     */
102
     */
81
    public function fetchAllDataTable($search, $page = 1, $records_per_page = 10, $order_field= 'title', $order_direction = 'ASC')
103
    public function fetchAllDataTable($search, $network_id, $page = 1, $records_per_page = 10, $order_field= 'title', $order_direction = 'ASC')
82
    {
104
    {
83
        $prototype = new Page();
105
        $prototype = new Page();
-
 
106
        $select = $this->sql->select(self::_TABLE);
Línea 84... Línea 107...
84
        $select = $this->sql->select(self::_TABLE);
107
        $select->where->equalTo('network_id', $network_id);
85
        
108
        
86
        if($search) {
109
        if($search) {
87
            $select->where->like('id', '%' . $search . '%')->or->like('title', '%' . $search . '%');
110
            $select->where->like('id', '%' . $search . '%')->or->like('title', '%' . $search . '%');
Línea 99... Línea 122...
99
        $paginator->setCurrentPageNumber($page);
122
        $paginator->setCurrentPageNumber($page);
Línea 100... Línea 123...
100
        
123
        
101
        
124
        
-
 
125
        return $paginator;
-
 
126
    }
-
 
127
    
-
 
128
    /**
-
 
129
     *
-
 
130
     * @return Page[]
-
 
131
     */
-
 
132
    public function fetchAllDefault()
-
 
133
    {
-
 
134
        $prototype = new Page();
-
 
135
        $select = $this->sql->select(self::_TABLE);
-
 
136
        $select->where->isNull('page_default_id');
-
 
137
        
-
 
138
        
-
 
139
        return $this->executeFetchAllObject($select, $prototype);
-
 
140
    }
102
        return $paginator;
141
    
103
    }
142
    
104
    /**
143
    /**
105
     *
144
     *
106
     * @param Page $page
145
     * @param Page $page
Línea 112... Línea 151...
112
        $values = $hydrator->extract($page);
151
        $values = $hydrator->extract($page);
Línea 113... Línea 152...
113
        
152
        
114
        $insert = $this->sql->insert(self::_TABLE);
153
        $insert = $this->sql->insert(self::_TABLE);
Línea 115... Línea 154...
115
        $insert->values($values);
154
        $insert->values($values);
-
 
155
        
-
 
156
        $result = $this->executeInsert($insert);
-
 
157
        
-
 
158
        if($result) {
-
 
159
            $page->id = $this->lastInsertId;
-
 
160
            return true;
116
        
161
        }
Línea 117... Línea 162...
117
        return $this->executeInsert($insert);
162
        return false;
118
    }
163
    }
119
    
164