Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7242 Rev 7300
Línea 12... Línea 12...
12
use Laminas\Paginator\Adapter\DbSelect;
12
use Laminas\Paginator\Adapter\DbSelect;
Línea 13... Línea 13...
13
 
13
 
14
 
14
 
15
class SurveyFormMapper extends MapperCommon
15
class SurveyFormMapper extends MapperCommon
Línea 16... Línea 16...
16
{
16
{
17
    const _TABLE = 'tbl_survey_tests';
17
    const _TABLE = 'tbl_survey_forms';
18
    
18
    
19
    /**
19
    /**
Línea 71... Línea 71...
71
        $select = $this->sql->select(self::_TABLE);
71
        $select = $this->sql->select(self::_TABLE);
72
        $select->where->equalTo('uuid', $uuid);
72
        $select->where->equalTo('uuid', $uuid);
Línea 73... Línea 73...
73
        
73
        
74
        return $this->executeFetchOneObject($select, $prototype);
74
        return $this->executeFetchOneObject($select, $prototype);
-
 
75
    }
-
 
76
    
-
 
77
    
-
 
78
    /**
-
 
79
     *
-
 
80
     * @param int $company_id
-
 
81
     * @return SurveyForm
-
 
82
     */
-
 
83
    public function fetchAllActiveNormalByCompanyId($company_id)
-
 
84
    {
-
 
85
        $prototype = new SurveyForm();
-
 
86
        
-
 
87
        $select = $this->sql->select(self::_TABLE);
-
 
88
        $select->where->equalTo('company_id', $company_id);
-
 
89
        $select->where->equalTo('type', SurveyForm::TYPE_NORMAL);
-
 
90
        $select->where->equalTo('active', SurveyForm::STATUS_ACTIVE);
-
 
91
        $select->order('name');
-
 
92
        
-
 
93
        return $this->executeFetchAllObject($select, $prototype);
-
 
94
    }
-
 
95
    
-
 
96
    
-
 
97
    
-
 
98
    /**
-
 
99
     *
-
 
100
     * @param int $company_id
-
 
101
     * @return SurveyForm
-
 
102
     */
-
 
103
    public function fetchAllActiveOrganizationalClimateByCompanyId($company_id)
-
 
104
    {
-
 
105
        $prototype = new SurveyForm();
-
 
106
        
-
 
107
        $select = $this->sql->select(self::_TABLE);
-
 
108
        $select->where->equalTo('company_id', $company_id);
-
 
109
        $select->where->equalTo('type', SurveyForm::TYPE_ORGANIZATIONAL_CLIMATE);
-
 
110
        $select->where->equalTo('active', SurveyForm::STATUS_ACTIVE);
-
 
111
        $select->order('name');
-
 
112
        
-
 
113
        return $this->executeFetchAllObject($select, $prototype);
Línea 75... Línea 114...
75
    }
114
    }
76
   
115
   
77
    
116
    
Línea 155... Línea 194...
155
     * @param int $records_per_page
194
     * @param int $records_per_page
156
     * @param string $order_field
195
     * @param string $order_field
157
     * @param string $order_direction
196
     * @param string $order_direction
158
     * @return Paginator
197
     * @return Paginator
159
     */
198
     */
160
    public function fetchAllDataTableByCompanyId($companyId, $search, $page = 1, $records_per_page = 10, $order_field= 'name', $order_direction = 'ASC')
199
    public function fetchAllDataTableNormalByCompanyId($companyId, $search, $page = 1, $records_per_page = 10, $order_field= 'name', $order_direction = 'ASC')
-
 
200
    {
-
 
201
        $prototype = new SurveyForm();
-
 
202
        $select = $this->sql->select(self::_TABLE);
-
 
203
        $select->where->equalTo('company_id', $companyId);
-
 
204
        $select->where->equalTo('type', SurveyForm::TYPE_NORMAL);
-
 
205
        
-
 
206
        if($search) {
-
 
207
            $select->where->like('name', '%' . $search . '%');
-
 
208
        }
-
 
209
        $select->order($order_field . ' ' . $order_direction);
-
 
210
        
-
 
211
        //echo $select->getSqlString($this->adapter->platform); exit;
-
 
212
        
-
 
213
        $hydrator   = new ObjectPropertyHydrator();
-
 
214
        $resultset  = new HydratingResultSet($hydrator, $prototype);
-
 
215
        
-
 
216
        $adapter = new DbSelect($select, $this->sql, $resultset);
-
 
217
        $paginator = new Paginator($adapter);
-
 
218
        $paginator->setItemCountPerPage($records_per_page);
-
 
219
        $paginator->setCurrentPageNumber($page);
-
 
220
        
-
 
221
        
-
 
222
        return $paginator;
-
 
223
    }
-
 
224
    
-
 
225
    
-
 
226
    /**
-
 
227
     *
-
 
228
     * @param int $companyId
-
 
229
     * @param string $search
-
 
230
     * @param int $page
-
 
231
     * @param int $records_per_page
-
 
232
     * @param string $order_field
-
 
233
     * @param string $order_direction
-
 
234
     * @return Paginator
-
 
235
     */
-
 
236
    public function fetchAllDataTableOrganizationClimateByCompanyId($companyId, $search, $page = 1, $records_per_page = 10, $order_field= 'name', $order_direction = 'ASC')
161
    {
237
    {
162
        $prototype = new SurveyForm();
238
        $prototype = new SurveyForm();
163
        $select = $this->sql->select(self::_TABLE);
239
        $select = $this->sql->select(self::_TABLE);
164
        $select->where->equalTo('company_id', $companyId);
240
        $select->where->equalTo('company_id', $companyId);
-
 
241
        $select->where->equalTo('type', SurveyForm::TYPE_ORGANIZATIONAL_CLIMATE);
Línea 165... Línea 242...
165
        
242
        
166
        if($search) {
243
        if($search) {
167
            $select->where->like('name', '%' . $search . '%');
244
            $select->where->like('name', '%' . $search . '%');
168
        }
245
        }