/** * Register a Configuration Screen that should appear in the Admin section. * @param string $app string appid * @param string $page string page to be included * @return void * @since 4.0.0 */ public static function registerAdmin($app, $page) { \OC_App::registerAdmin($app, $page); }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ if (\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { $updater = new \OC\Updater\VersionCheck(\OC::$server->getHTTPClientService(), \OC::$server->getConfig()); $updateChecker = new \OCA\UpdateNotification\UpdateChecker($updater); $userObject = \OC::$server->getUserSession()->getUser(); if ($userObject !== null) { if (\OC::$server->getGroupManager()->isAdmin($userObject->getUID())) { if ($updateChecker->getUpdateState() !== []) { \OCP\Util::addScript('updatenotification', 'notification'); OC_Hook::connect('\\OCP\\Config', 'js', $updateChecker, 'getJavaScript'); } \OC_App::registerAdmin('updatenotification', 'admin'); } } $manager = \OC::$server->getNotificationManager(); $manager->registerNotifier(function () use($manager) { return new \OCA\UpdateNotification\Notification\Notifier($manager, \OC::$server->getL10NFactory()); }, function () { $l = \OC::$server->getL10N('updatenotification'); return ['id' => 'updatenotification', 'name' => $l->t('Update notifications')]; }); }
<?php /** * register the page of admin settings form */ OC_App::registerAdmin('neurocloud', 'settings'); /** * register the navigation entry */ OC_App::addNavigationEntry(array('id' => 'neurocloud_index', 'order' => 74, 'href' => OC_Helper::linkTo('neurocloud', 'index.php'), 'icon' => OC_Helper::imagePath('neurocloud', 'neurocloud.png'), 'name' => 'Neurocloud')); /** * register the classpath */ OC::$CLASSPATH["OC_Neurocloud"] = "apps/neurocloud/lib/hooks.php"; /** * register the hooks for file writing * * NOTE: to make sure that the hooks are called everytime that a file is written, the application * must be registered with type "filesystem". Otherwise, those hooks will be called only when uploading from the web interface * * to register the application as a filesystem type, put in info.xml * * <types><filesystem/></types> * */ #OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_write, "OC_Neurocloud", "beforeFileWrite"); #OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_post_write, "OC_Neurocloud", "afterFileWrite"); OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, 'post_delete', "OC_Neurocloud", "fileDeleted"); OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_post_rename, "OC_Neurocloud", "fileRenamed"); // hooks for delete/rename, do not allow deleting of directory if there is a running job OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_delete, "OC_Neurocloud", "beforeFileRenameDelete"); OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_rename, "OC_Neurocloud", "beforeFileRenameDelete");