/** * Generate box output * Sets local language * * @param array $params */ function generate_output($params = '') { // Load plugin configuration form database $this->set_configuration(); // Set local template $this->set_template($params); if ($params['search_id'] > 0) { $article_images_list = new ArticleAttachments_list(); $article_images = $article_images_list->get_attachments_by_article_id($params['search_id']); if ($article_images) { $this->_template->assign('attachment_list', $article_images); $this->_template->assign('attachment_list_object', $article_images_list); } } else { $this->_template->assign('attachment_list', strval('')); $this->_template->assign('attachment_list_object', strval('')); } }
/** * Reorder attachments * @param integer $article_id * @param array $data * @return boolean true on succes, or false on fail */ function reorder($order) { $sm = vivvo_lite_site::get_instance(); if ($sm->user) { if ($sm->user->can('MANAGE_PLUGIN', 'multiple_attachments')) { $order_number = 1; foreach ($order as $id) { $article_attachments_list = new ArticleAttachments_list(); $attachment = $article_attachments_list->get_attachment_by_id($id); if ($attachment !== false) { $attachment->set_order_number($order_number); $this->_post_master->set_data_object($attachment); if ($this->_post_master->sql_update()) { $order_number++; } } } return true; } else { $this->set_error_code(11312); return false; } } else { $this->set_error_code(11313); return false; } }