Admin view to be used for review purpose for data created by site users. The data collected by user will be submitted for admin review as part of approval process.
493083
public function renderViewAdmin( $template, $models, $config = [] ) {

		return $this->renderViewGeneric( $template, $models, CoreGlobal::TPL_VIEW_ADMIN, $config );
	}
274910
def _add_admin_views(self):
        
        self.indexview = self._check_and_init(self.indexview)
        self.add_view_no_menu(self.indexview)
        self.add_view_no_menu(UtilView())
        self.bm.register_views()
        if self.get_app.config.get('FAB_ADD_SECURITY_VIEWS', True):
            self.sm.register_views()
        if self.get_app.config.get('FAB_ADD_OPENAPI_VIEWS', True):
            self.openapi_manager.register_views()
727332
protected function controlAccessEditReview()
    {
        if (!$this->config('review_enabled', 1) || empty($this->uid)) {
            $this->outputHttpStatus(403);
        }

        if (!$this->config('review_editable', 1)) {
            $this->outputHttpStatus(403);
        }

        if (isset($this->data_review['review_id']) && $this->data_review['user_id'] != $this->uid) {
            $this->outputHttpStatus(403);
        }
    }
717938
def admin_update
      return if !user_is_allowed('orders', 'edit')
      
      resp = Caboose::StdClass.new({'attributes' => {}})
      order = Order.find(params[:id])    
      
      save = true    
      params.each do |name,value|
        case name
          when 'tax'
            order.tax = value          
          when 'shipping'
            order.shipping = value
          when 'handling'
            order.handling = value
          when 'discount'
            order.discount = value        
          when 'status'
            order.status = value
            resp.attributes['status'] = {'text' => value}
        end
      end
      order.calculate_total    
      resp.success = save && order.save
      render :json => resp
    end
1354928
def save_model(self, request, obj, form, change):
        
        super(SitePermissionUserAdmin, self).save_model(
            request, obj, form, change)
        user = self.model.objects.get(id=obj.id)
        has_perms = len(user.get_all_permissions()) > 0
        has_sites = SitePermission.objects.filter(user=user).count() > 0
        if user.is_active and user.is_staff and not user.is_superuser and not (
                has_perms and has_sites):
            error(request, "The user is active but won't be able to access "
                           "the admin, due to no edit/site permissions being "
                           "selected")
861261
protected function createView()
    {
        if ($this->files->exists($path = $this->getViewPath())) {
            $this->error('View already exists!');

            return;
        }

        $this->makeDirectory($path);
        $view = $this->files->get($this->getViewStub('view'));
        $this->files->put($path, $view);

        $form = $this->files->get($this->getViewStub('form'));
        $this->files->put($this->getViewPath('_form'), $form);

        $this->info('Views successfully created.');
    }
1234366
public function isUserAdmin()
	{
		$user = $this->getUsersDatabase();
		$sr = $user->getById($this->_context->authenticatedUserId());
		return ($sr->getField($user->getUserTable()->admin) == "yes");
	}
1167603
public function createPermissionsView()
    {
        $schemasPath = __DIR__ . DIRECTORY_SEPARATOR . 'schemas';
        if (is_dir($schemasPath)) {
            $fileSystem = app('files');
            $files      = $fileSystem->allFiles($schemasPath);
            foreach ($files as $file) {
                DB::unprepared($file->getContents());
            }
        }
    }
984932
protected function wizardAddReview()
    {
        $this->validatePrompt('user_id', $this->text('User'), 'review');
        $this->validatePrompt('product_id', $this->text('Product'), 'review');
        $this->validatePrompt('text', $this->text('Text'), 'review');
        $this->validatePrompt('status', $this->text('Status'), 'review', 0);

        $this->validateComponent('review');
        $this->addReview();
    }
1127348
def view_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/views.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
2609
protected function submitAddReview()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('review');
        $this->addReview();
    }
25333
public function saveReview()
    {
        if (!\OxidEsales\Eshop\Core\Registry::getSession()->checkSessionChallenge()) {
            return;
        }

        if ($this->canAcceptFormData() &&
            ($oRecommList = $this->getActiveRecommList()) && ($oUser = $this->getUser())
        ) {
            //save rating
            $dRating = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('recommlistrating');
            if ($dRating !== null) {
                $dRating = (int) $dRating;
            }

            if ($dRating !== null && $dRating >= 1 && $dRating <= 5) {
                $oRating = oxNew(\OxidEsales\Eshop\Application\Model\Rating::class);
                if ($oRating->allowRating($oUser->getId(), 'oxrecommlist', $oRecommList->getId())) {
                    $oRating->oxratings__oxuserid = new \OxidEsales\Eshop\Core\Field($oUser->getId());
                    $oRating->oxratings__oxtype = new \OxidEsales\Eshop\Core\Field('oxrecommlist');
                    $oRating->oxratings__oxobjectid = new \OxidEsales\Eshop\Core\Field($oRecommList->getId());
                    $oRating->oxratings__oxrating = new \OxidEsales\Eshop\Core\Field($dRating);
                    $oRating->save();
                    $oRecommList->addToRatingAverage($dRating);
                }
            }

            if (($sReviewText = trim(( string ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('rvw_txt', true)))) {
                $oReview = oxNew(\OxidEsales\Eshop\Application\Model\Review::class);
                $oReview->oxreviews__oxobjectid = new \OxidEsales\Eshop\Core\Field($oRecommList->getId());
                $oReview->oxreviews__oxtype = new \OxidEsales\Eshop\Core\Field('oxrecommlist');
                $oReview->oxreviews__oxtext = new \OxidEsales\Eshop\Core\Field($sReviewText, \OxidEsales\Eshop\Core\Field::T_RAW);
                $oReview->oxreviews__oxlang = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage());
                $oReview->oxreviews__oxuserid = new \OxidEsales\Eshop\Core\Field($oUser->getId());
                $oReview->oxreviews__oxrating = new \OxidEsales\Eshop\Core\Field(($dRating !== null) ? $dRating : null);
                $oReview->save();
            }
        }
    }
475404
def admin_update
      return if !user_is_allowed('products', 'edit')
      
      resp = Caboose::StdClass.new({'attributes' => {}})
      product = Product.find(params[:id])    
      
      save = true    
      params.each do |name,value|
        case name
          when 'alternate_id'
            product.alternate_id = value
          when 'date_available'
            if value.strip.length == 0
              product.date_available = nil
            else
              begin
                product.date_available = DateTime.parse(value)
              rescue
                resp.error = "Invalid date"
                save = false
              end
            end
          when 'title'
            product.title = value
          when 'caption'
            product.caption = value
          when 'featured'
            product.featured = value
          when 'description'
            product.description = value
          when 'category_id'
            product.category_id = value
          when 'vendor_id'  
            product.vendor_id = value
          when 'handle'
            product.handle = value
          when 'seo_title'
            product.seo_title = value
          when 'seo_description'
            product.seo_description = value
          when 'option1'
            product.option1 = value
          when 'option2'
            product.option2 = value
          when 'option3'
            product.option3 = value
          when 'default1'
            product.default1 = value
            Variant.where(:product_id => product.id, :option1 => nil).each do |p|
              p.option1 = value
              p.save
            end
          when 'default2'
            product.default2 = value
            Variant.where(:product_id => product.id, :option2 => nil).each do |p|
              p.option2 = value
              p.save
            end
          when 'default3'
            product.default3 = value
            Variant.where(:product_id => product.id, :option3 => nil).each do |p|
              p.option3 = value
              p.save
            end
          when 'status'
            product.status = value
        end
      end
      resp.success = save && product.save
      render :json => resp
    end
1365902
protected function deleteReview()
    {
        $this->controlAccess('review_delete');

        if ($this->review->delete($this->data_review['review_id'])) {
            $this->redirect('admin/content/review', $this->text('Review has been deleted'), 'success');
        }

        $this->redirect('', $this->text('Review has not been deleted'), 'warning');
    }
824
protected function addReview()
    {
        if (!$this->isError()) {
            $id = $this->review->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
1249298
protected function validateEditReview()
    {
        $this->setSubmitted('review');
        $this->filterSubmitted(array('text', 'rating'));
        $this->setSubmitted('user_id', $this->uid);
        $this->setSubmitted('update', $this->data_review);
        $this->setSubmitted('product_id', $this->data_product['product_id']);
        $this->setSubmitted('status', (int) $this->config('review_status', 1));

        $this->validateComponent('review');

        return !$this->hasErrors(false);
    }
618243
def admin_view_url(admin_site: AdminSite,
                   obj,
                   view_type: str = "change",
                   current_app: str = None) -> str:
    
    app_name = obj._meta.app_label.lower()
    model_name = obj._meta.object_name.lower()
    pk = obj.pk
    viewname = "admin:{}_{}_{}".format(app_name, model_name, view_type)
    if current_app is None:
        current_app = admin_site.name
    url = reverse(viewname, args=[pk], current_app=current_app)
    return url