Beispiel #1
0
 public static function updateLanguages()
 {
     if (config('gtcms.premium') && \Auth::user()->is_superadmin) {
         if (!empty($_POST)) {
             if (\Request::get('updateLanguages') == "Proceed") {
                 foreach (AdminHelper::modelConfigs() as $modelConfig) {
                     GtcmsPremium::updateLanguages($modelConfig);
                 }
                 MessageManager::setSuccess("Languages updated");
             }
             return \Redirect::to("/admin");
         }
         $data = array('active' => false, 'modelConfig' => new ModelConfig());
         return \View::make("gtcms.admin.elements.updateLanguages")->with($data);
     } else {
         \Session::set('accessDenied', true);
         return self::restricted();
     }
 }
 private static function ajaxRedirect($object = false, $action = false, $quickEdit = false)
 {
     $data = array('success' => true, 'returnToParent' => false, 'quickEdit' => $quickEdit, 'objectRow' => false, 'objectId' => false);
     if (!self::$modelConfig->relatedModels) {
         $data['returnToParent'] = true;
     }
     if (config('gtcms.preventRedirectOnSave') || $quickEdit) {
         $data['returnToParent'] = false;
     }
     /** @var \App\BaseModel $object */
     if (config('gtcms.premium') && $quickEdit) {
         GtcmsPremium::setQuickEditReturnData($data, $object, self::$modelConfig);
     }
     // If object has just been successfully added
     if ($action == 'add' && !$data['returnToParent'] && self::$modelConfig->name != "GtcmsSetting") {
         $printProperty = self::$modelConfig->printProperty;
         $data['replaceCurrentHistory'] = array('modelName' => self::$modelConfig->hrName, 'objectName' => $printProperty ? $object->{$printProperty} : false);
         $fullUrl = str_replace("/edit/new", "/edit/" . $object->id, \Request::fullUrl());
         $data['replaceUrl'] = $fullUrl;
         $data['objectId'] = $object->id;
         AdminHistoryManager::replaceAddLink($fullUrl, self::$modelConfig->name);
     }
     return \Response::json($data);
 }