Proyectos de Subversion LeadersLinked - Services

Rev

Rev 308 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 308 Rev 311
Línea 129... Línea 129...
129
        $select->where->in('company_id', $company_ids);
129
        $select->where->in('company_id', $company_ids);
130
        $select->where->equalTo('template', HabitSkill::TEMPLATE_YES);
130
        $select->where->equalTo('template', HabitSkill::TEMPLATE_YES);
Línea 131... Línea 131...
131
        
131
        
132
        return $this->executeFetchAllObject($select, $prototype);
132
        return $this->executeFetchAllObject($select, $prototype);
-
 
133
    }
-
 
134
    
-
 
135
    /**
-
 
136
     *
-
 
137
     * @param int $company_id
-
 
138
     * @param string $search
-
 
139
     * @param int $page
-
 
140
     * @param int $records_per_page
-
 
141
     * @param string $order_field
-
 
142
     * @param string $order_direction
-
 
143
     * @return Paginator
-
 
144
     */
-
 
145
    public function fetchAllDataTableTemplates($company_id, $search, $page = 1, $records_per_page = 10, $order_field= 'name', $order_direction = 'ASC')
-
 
146
    {
-
 
147
        $prototype = new HabitSkill();
-
 
148
        $select = $this->sql->select(self::_TABLE);
-
 
149
        
-
 
150
        if($search) {
-
 
151
            $select->where->like('name', '%' . $search . '%');
-
 
152
        }
-
 
153
        $select->where->equalTo('company_id', $company_id);
-
 
154
        $select->order($order_field . ' ' . $order_direction);
-
 
155
        
-
 
156
        
-
 
157
        
-
 
158
        // echo $select->getSqlString($this->adapter->platform); exit;
-
 
159
        
-
 
160
        $hydrator   = new ObjectPropertyHydrator();
-
 
161
        $resultset  = new HydratingResultSet($hydrator, $prototype);
-
 
162
        
-
 
163
        $adapter = new DbSelect($select, $this->sql, $resultset);
-
 
164
        $paginator = new Paginator($adapter);
-
 
165
        $paginator->setItemCountPerPage($records_per_page);
-
 
166
        $paginator->setCurrentPageNumber($page);
-
 
167
        
-
 
168
        
-
 
169
        return $paginator;
Línea 133... Línea 170...
133
    }
170
    }
134
     
171
     
Línea 150... Línea 187...
150
        $select = $this->sql->select(self::_TABLE);
187
        $select = $this->sql->select(self::_TABLE);
Línea 151... Línea 188...
151
        
188
        
152
        if($search) {
189
        if($search) {
153
            $select->where->like('name', '%' . $search . '%');
190
            $select->where->like('name', '%' . $search . '%');
-
 
191
        }
154
        }
192
        $select->where->equalTo('user_id', $user_id);
Línea 155... Línea 193...
155
        $select->order($order_field . ' ' . $order_direction);
193
        $select->order($order_field . ' ' . $order_direction);
Línea 156... Línea 194...
156
        
194
        
Línea 187... Línea 225...
187
        $values['saturday_active']              = empty($values['saturday_active']) ? 0 : 1;
225
        $values['saturday_active']              = empty($values['saturday_active']) ? 0 : 1;
188
        $values['sunday_active']                = empty($values['sunday_active']) ? 0 : 1;
226
        $values['sunday_active']                = empty($values['sunday_active']) ? 0 : 1;
189
        $values['notification_10min_before']    = empty($values['notification_10min_before']) ? 0 : 1;
227
        $values['notification_10min_before']    = empty($values['notification_10min_before']) ? 0 : 1;
190
        $values['notification_30min_before']    = empty($values['notification_30min_before']) ? 0 : 1;
228
        $values['notification_30min_before']    = empty($values['notification_30min_before']) ? 0 : 1;
Línea -... Línea 229...
-
 
229
        
-
 
230
        
-
 
231
        
-
 
232
        $values['monday_time']                = empty($values['monday_time']) ? '' : $values['monday_time'];
-
 
233
        $values['tuesday_time']               = empty($values['tuesday_time']) ? '' : $values['tuesday_time'];
-
 
234
        $values['wednesday_time']             = empty($values['wednesday_time']) ? '' : $values['wednesday_time'];
-
 
235
        $values['thursday_time']              = empty($values['thursday_time']) ? '' : $values['thursday_time'];
-
 
236
        $values['friday_time']                = empty($values['friday_time']) ? '' : $values['friday_time'];
-
 
237
        $values['saturday_time']              = empty($values['saturday_time']) ? '' : $values['saturday_time'];
-
 
238
        $values['sunday_time']                = empty($values['sunday_time']) ? '' : $values['sunday_time'];
-
 
239
        
191
        
240
        
192
        $insert = $this->sql->insert(self::_TABLE);
241
        $insert = $this->sql->insert(self::_TABLE);
Línea 193... Línea 242...
193
        $insert->values($values);
242
        $insert->values($values);
Línea 220... Línea 269...
220
        $values['friday_active']                = empty($values['friday_active']) ? 0 : 1;
269
        $values['friday_active']                = empty($values['friday_active']) ? 0 : 1;
221
        $values['saturday_active']              = empty($values['saturday_active']) ? 0 : 1;
270
        $values['saturday_active']              = empty($values['saturday_active']) ? 0 : 1;
222
        $values['sunday_active']                = empty($values['sunday_active']) ? 0 : 1;
271
        $values['sunday_active']                = empty($values['sunday_active']) ? 0 : 1;
223
        $values['notification_10min_before']    = empty($values['notification_10min_before']) ? 0 : 1;
272
        $values['notification_10min_before']    = empty($values['notification_10min_before']) ? 0 : 1;
224
        $values['notification_30min_before']    = empty($values['notification_30min_before']) ? 0 : 1;
273
        $values['notification_30min_before']    = empty($values['notification_30min_before']) ? 0 : 1;
-
 
274
        
-
 
275
        
-
 
276
        $values['monday_time']                = empty($values['monday_time']) ? '' : $values['monday_time'];
-
 
277
        $values['tuesday_time']               = empty($values['tuesday_time']) ? '' : $values['tuesday_time'];
-
 
278
        $values['wednesday_time']             = empty($values['wednesday_time']) ? '' : $values['wednesday_time'];
-
 
279
        $values['thursday_time']              = empty($values['thursday_time']) ? '' : $values['thursday_time'];
-
 
280
        $values['friday_time']                = empty($values['friday_time']) ? '' : $values['friday_time'];
-
 
281
        $values['saturday_time']              = empty($values['saturday_time']) ? '' : $values['saturday_time'];
-
 
282
        $values['sunday_time']                = empty($values['sunday_time']) ? '' : $values['sunday_time'];
Línea 225... Línea 283...
225
            
283
            
226
        $update = $this->sql->update(self::_TABLE);
284
        $update = $this->sql->update(self::_TABLE);
227
        $update->set($values);
285
        $update->set($values);