Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 2962 Rev 3262
Línea 61... Línea 61...
61
        return $record['total'];
61
        return $record['total'];
62
    }
62
    }
Línea 63... Línea 63...
63
    
63
    
64
    /**
64
    /**
-
 
65
     *
-
 
66
     * @param string $uuid
-
 
67
     * @return Notification
-
 
68
     */
-
 
69
    public function fetchOneByUuid($uuid)
-
 
70
    {
-
 
71
        $prototype = new Notification();
-
 
72
        
-
 
73
        $select = $this->sql->select(self::_TABLE);
-
 
74
        $select->where->equalTo('uuid', $uuid);
-
 
75
        
-
 
76
        return $this->executeFetchOneObject($select, $prototype);
-
 
77
    }
-
 
78
    
-
 
79
    
-
 
80
    /**
65
     *
81
     *
66
     * @param int $user_id
82
     * @param int $user_id
67
     * @return Notification[]
83
     * @return Notification[]
68
     */
84
     */
69
    public function fetchAllsUnreadByUserId($user_id)
85
    public function fetchAllsUnreadByUserId($user_id)
70
    {
86
    {
Línea 71... Línea 87...
71
        $prototype = new Notification();
87
        $prototype = new Notification();
72
        
88
        
-
 
89
        $select = $this->sql->select(self::_TABLE);
Línea 73... Línea 90...
73
        $select = $this->sql->select(self::_TABLE);
90
        $select->where->equalTo('user_id', $user_id)->and->equalTo('read', Notification::NO);
74
        $select->where->equalTo('user_id', $user_id)->and->equalTo('read', Notification::NO);
91
    
Línea 75... Línea 92...
75
        
92
        
76
        return $this->executeFetchAllObject($select, $prototype);
93
        return $this->executeFetchAllObject($select, $prototype);
77
    }
94
    }
78
 
95
 
79
    /**
96
    /**
80
     *
97
     *
81
     * @param int $user_id
98
     * @param int $user_id
82
     * @return Notification[]
99
     * @return Notification[]
Línea 83... Línea 100...
83
     */
100
     */
84
    public function fetchAllsReadByUserId($user_id)
101
    public function fetchAllByUserId($user_id)
Línea 91... Línea 108...
91
        $select->order(['added_on DESC']);
108
        $select->order(['added_on DESC']);
92
        return $this->executeFetchAllObject($select, $prototype);
109
        return $this->executeFetchAllObject($select, $prototype);
93
    }
110
    }
Línea 94... Línea 111...
94
    
111
    
95
    /**
112
    /**
96
     * 
113
     *
97
     * @param int $user_id
114
     * @param int $user_id
98
     * @return boolean
115
     * @return boolean
99
     */
116
     */
100
    public function markAllNotificationsAsReadByUserId($user_id)
117
    public function markAllAsReadByUserId($user_id)
101
    {
118
    {
102
        $update = $this->sql->update(self::_TABLE);
119
        $update = $this->sql->update(self::_TABLE);
103
        $update->set(['read' => Notification::YES]);
120
        $update->set(['read' => Notification::YES]);
104
        $update->where->equalTo('user_id', $user_id);
121
        $update->where->equalTo('user_id', $user_id);
Línea 107... Línea 124...
107
        return $this->executeUpdate($update);
124
        return $this->executeUpdate($update);
108
    }
125
    }
Línea 109... Línea 126...
109
    
126
    
-
 
127
    
-
 
128
    /**
-
 
129
     * 
-
 
130
     * @param int $id
-
 
131
     * @return boolean
-
 
132
     */
-
 
133
    public function markAsReadById($id)
-
 
134
    {
-
 
135
        $update = $this->sql->update(self::_TABLE);
-
 
136
        $update->set(['read' => Notification::YES]);
-
 
137
        $update->where->equalTo('id', $id);
-
 
138
 
-
 
139
        return $this->executeUpdate($update);
-
 
140
    }
-
 
141
    
-
 
142
    /**
-
 
143
     *
-
 
144
     * @param int $id
-
 
145
     * @return boolean
-
 
146
     */
-
 
147
    public function deleteById($id)
-
 
148
    {
-
 
149
        $delete = $this->sql->delete(self::_TABLE);
-
 
150
        $delete->where->equalTo('id', $id);
-
 
151
        
-
 
152
        return $this->executeDelete($delete);
-
 
153
    }
-
 
154
    
-
 
155
    /**
-
 
156
     *
-
 
157
     * @param int $user_id
-
 
158
     * @return boolean
-
 
159
     */
-
 
160
    public function deleteAllByUserId($user_id)
-
 
161
    {
-
 
162
        $delete = $this->sql->delete(self::_TABLE);
-
 
163
        $delete->where->equalTo('user_id', $user_id);
-
 
164
        
-
 
165
        return $this->executeDelete($delete);
-
 
166
    }
-
 
167
    
110
    
168
    
111
    /**
169
    /**
112
     *
170
     *
113
     * @param int $user_id
171
     * @param int $user_id
114
     * @param int $company_id
172
     * @param int $company_id