* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Shawn Rice <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access defined('_HZEXEC_') or die; $results = array(); $entries = \Plugins\Courses\Notes\Models\Note::all()->whereEquals('section_id', $this->offering->section()->get('id'))->whereEquals('created_by', User::get('id'))->whereEquals('state', 1); if ($this->filters['search']) { $entries->whereLike('content', $this->filters['search']); } $notes = $entries->rows(); if ($notes->count()) { foreach ($notes as $note) { $ky = $note->get('scope_id'); if (!isset($results[$ky])) { $results[$ky] = array(); } $results[$ky][] = $note; } } $base = $this->offering->link(); if (count($results)) {
$obj = new stdClass(); $obj->id = $note->get('id'); $obj->dataId = $note->get('id'); $obj->text = str_replace(' ', ' ', nl2br(stripslashes($note->get('content')))); $obj->pos_x = $note->get('pos_x') . 'px'; $obj->pos_y = $note->get('pos_y') . 'px'; $obj->width = $note->get('width'); $obj->height = $note->get('height'); $obj->timestamp = $note->get('timestamp'); $obj->access = $note->get('access'); $obj->editable = true; $n[] = $obj; } } if (!$this->course->access('manage')) { $notes = \Plugins\Courses\Notes\Models\Note::all()->whereEquals('scope', 'lecture')->whereEquals('scope_id', $this->lecture->get('id'))->whereEquals('access', 1)->whereEquals('state', 1)->rows(); if ($notes->count()) { foreach ($notes as $note) { $obj = new stdClass(); $obj->id = $note->get('id'); $obj->dataId = $note->get('id'); $obj->text = str_replace(' ', ' ', nl2br(stripslashes($note->get('content')))); $obj->pos_x = $note->get('pos_x') . 'px'; $obj->pos_y = $note->get('pos_y') . 'px'; $obj->width = $note->get('width'); $obj->height = $note->get('height'); $obj->timestamp = $note->get('timestamp'); $obj->access = $note->get('access'); $obj->editable = false; $n[] = $obj; }
/** * Delete a record * * @return mixed */ public function _delete() { $note_id = Request::getInt('note', 0); $model = \Plugins\Courses\Notes\Models\Note::oneOrFail($note_id); $model->set('state', 2); if (!$model->save()) { $this->setError($model->getError()); } if (!$this->view->no_html) { return $this->_list(); } return $note_id; }