Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6749 Rev 7016
Línea 43... Línea 43...
43
            self::$_instance = new PlanningTaskMapper($adapter);
43
            self::$_instance = new PlanningTaskMapper($adapter);
44
        }
44
        }
45
        return self::$_instance;
45
        return self::$_instance;
46
    }
46
    }
Línea 47... Línea 47...
47
 
47
 
-
 
48
    
48
 
49
    /**
-
 
50
     * 
-
 
51
     * @param int $company_id
-
 
52
     * @param int $goal_id
-
 
53
     * @param string $search
-
 
54
     * @param int $page
-
 
55
     * @param int $records_per_page
-
 
56
     * @param string $order_field
-
 
57
     * @param string $order_direction
-
 
58
     * @return \Laminas\Paginator\Paginator
49
 
59
     */
50
    public function fetchAllDataTable($search, $page = 1, $records_per_page = 10, $order_field= 'title', $order_direction = 'ASC', $goal_id)
60
    public function fetchAllDataTableByCompanyIdAndGoalId($company_id, $goal_id, $search, $page = 1, $records_per_page = 10, $order_field= 'title', $order_direction = 'ASC')
51
    {
61
    {
52
        $prototype = new PlanningTask();
62
        $prototype = new PlanningTask();
-
 
63
        $select = $this->sql->select(self::_TABLE);
53
        $select = $this->sql->select(self::_TABLE);
64
        $select->where->equalTo('company_id', $goal_id);
54
        $select->where->equalTo('goal_id', $goal_id);
-
 
-
 
65
        $select->where->equalTo('goal_id', $goal_id);
Línea 55... Línea 66...
55
        $select->where->notEqualTo('status', PlanningTask::STATUS_DELETE);
66
 
56
        
67
        
57
        
68
        
Línea 71... Línea 82...
71
        $paginator->setCurrentPageNumber($page);
82
        $paginator->setCurrentPageNumber($page);
Línea 72... Línea 83...
72
        
83
        
73
        
84
        
-
 
85
        return $paginator;
-
 
86
    }
-
 
87
    
-
 
88
    /**
-
 
89
     * 
-
 
90
     * @param int $company_id
-
 
91
     * @param int $goal_id
74
        return $paginator;
92
     * @return PlanningTask[]
75
    }
93
     */
76
    public function fetchAll($goal_id)
94
    public function fetchAllByCompanyIdAndGoalId($company_id, $goal_id)
77
    {
95
    {
78
        $prototype = new PlanningTask();
96
        $prototype = new PlanningTask();
79
        $select = $this->sql->select(self::_TABLE);
97
        $select = $this->sql->select(self::_TABLE);
-
 
98
        $select->where->equalTo('company_id', $company_id);
-
 
99
        $select->where->equalTo('goal_id', $goal_id);
80
        $select->where->equalTo('goal_id', $goal_id)->equalTo('status', 'a');
100
        $select->order('title');
Línea 81... Línea 101...
81
        $select->where->notEqualTo('status', PlanningTask::STATUS_DELETE);
101
        
-
 
102
        return $this->executeFetchAllObject($select, $prototype);
-
 
103
        
-
 
104
    }
-
 
105
    
-
 
106
    /**
-
 
107
     *
-
 
108
     * @param int $company_id
-
 
109
     * @param int $goal_id
-
 
110
     * @return PlanningTask[]
-
 
111
     */
-
 
112
    public function fetchAllActiveByCompanyIdAndGoalId($company_id, $goal_id)
-
 
113
    {
-
 
114
        $prototype = new PlanningTask();
-
 
115
        $select = $this->sql->select(self::_TABLE);
-
 
116
        $select->where->equalTo('company_id', $company_id);
-
 
117
        $select->where->equalTo('goal_id', $goal_id);
-
 
118
        $select->where->equalTo('status', PlanningTask::STATUS_ACTIVE);
-
 
119
        $select->order('title');
-
 
120
        
-
 
121
        return $this->executeFetchAllObject($select, $prototype);
Línea -... Línea 122...
-
 
122
        
-
 
123
    }
-
 
124
    
-
 
125
 
-
 
126
    /**
82
        return $this->executeFetchAllObject($select, $prototype);
127
     * 
83
        
128
     * @param PlanningTask $record
84
    }
129
     * @return boolean
85
 
130
     */
86
    public function insert($datos)
131
    public function insert($record)
-
 
132
    {
-
 
133
        $hydrator = new ObjectPropertyHydrator();
-
 
134
        $values = $hydrator->extract($record);
-
 
135
        $values = $this->removeEmpty($values);
-
 
136
        
-
 
137
        $values['urgent'] = empty($values['urgent']) ? PlanningTask::NO : $values['urgent'];
-
 
138
        $values['priority'] = empty($values['priority']) ? PlanningTask::NO : $values['priority'];
87
    {
139
        $values['cost'] = empty($values['cost']) ? 0 : $values['cost'];
88
        $hydrator = new ObjectPropertyHydrator();
140
        $values['progress'] = empty($values['progress']) ? 0 : $values['progress'];
Línea 89... Línea 141...
89
        $values = $hydrator->extract($datos);
141
        
90
        $values = $this->removeEmpty($values);
142
        
91
        $insert = $this->sql->insert(self::_TABLE);
143
        $insert = $this->sql->insert(self::_TABLE);
92
        $insert->values($values);
144
        $insert->values($values);
Línea 93... Línea 145...
93
        
145
        
Línea 94... Línea 146...
94
        
146
        
Línea -... Línea 147...
-
 
147
        $result = $this->executeInsert($insert);
-
 
148
        if($result) {
-
 
149
            $record->id = $this->lastInsertId;
-
 
150
        }
-
 
151
        
95
        $result = $this->executeInsert($insert);
152
        return $result;
96
        if($result) {
153
        
97
            $datos->id = $this->lastInsertId;
154
    } 
98
        }
155
    
99
        
156
    /**
Línea -... Línea 157...
-
 
157
     * 
-
 
158
     * @param PlanningTask $record
-
 
159
     * @return boolean
-
 
160
     */
-
 
161
    public function update($record)
-
 
162
    {
100
        return $result;
163
        $hydrator = new ObjectPropertyHydrator();
101
        
164
        $values = $hydrator->extract($record);
102
    } 
165
        $values = $this->removeEmpty($values);
-
 
166
        
103
    
167
        
104
    public function update($form)
168
        $values['urgent'] = empty($values['urgent']) ? PlanningTask::NO : $values['urgent'];
Línea -... Línea 169...
-
 
169
        $values['priority'] = empty($values['priority']) ? PlanningTask::NO : $values['priority'];
-
 
170
        $values['cost'] = empty($values['cost']) ? 0 : $values['cost'];
-
 
171
        $values['progress'] = empty($values['progress']) ? 0 : $values['progress'];
-
 
172
        
-
 
173
        $update = $this->sql->update(self::_TABLE);
105
    {
174
        $update->set($values);
106
        $hydrator = new ObjectPropertyHydrator();
175
        $update->where->equalTo('id', $record->id);
107
        $values = $hydrator->extract($form);
176
        
108
        $values = $this->removeEmpty($values);
177
        return $this->executeUpdate($update); 
Línea 109... Línea 178...
109
        
178
    }
110
        $update = $this->sql->update(self::_TABLE);
179
    
Línea -... Línea 180...
-
 
180
    /**
-
 
181
     * 
-
 
182
     * @param PlanningTask $record
-
 
183
     * @return boolean
-
 
184
     */
111
        $update->set($values);
185
    public function delete($record)
112
        $update->where->equalTo('id', $form->id);
186
    {
113
        return $this->executeUpdate($update); 
187
        $delete = $this->sql->delete(self::_TABLE);
114
    }
188
        $delete->where->equalTo('id', $record->id);
115
    
189