count required tab separator elements

@param ContentWrapper\Model $model

@return int
340681
public function countRequiredTabSeparators(ContentWrapper\Model $model)
	{
		if($model->getType() != ContentWrapper\Model::TYPE_START) {
			$model = \ContentModel::findByPk($model->bootstrap_parentId);
		}

		$tabs = array();

		if($model->bootstrap_tabs) {
			$tabs = deserialize($model->bootstrap_tabs, true);
		}
		elseif(\Input::post('bootstrap_tabs')) {
			$tabs = \Input::post('bootstrap_tabs');
		}

		$count = 0;

		foreach($tabs as $tab) {
			if($tab['type'] != 'dropdown') {
				$count++;
			}
		}

		return $count > 0 ? ($count - 1 ) : 0;
	}
563949
public function purgeDeletedCount($model, $expiration = '-90 days') {
		$this->softDelete($model, false);
		return $model->find('count', array(
				'conditions' => $this->_purgeDeletedConditions($model, $expiration),
				'recursive' => -1,
				'contain' => array()
			)
		);
	}
109301
protected function buildRowsFromModel($model): void
    {
        $this->model = $model = $this->buildModel($model);

        if ($model instanceof Paginator) {
            $this->setRowsData($model->items());
            $this->paginate = true;
        } elseif ($model instanceof Collection) {
            $this->setRowsData($model->all());
        } elseif ($model instanceof Arrayable) {
            $this->setRowsData($model->toArray());
        } elseif (\is_array($model)) {
            $this->setRowsData($model);
        } else {
            throw new InvalidArgumentException('Unable to convert $model to array.');
        }
    }
296144
public function replaceTags($model)
    {
        if (isset($model->attributes)) {
            foreach ($model->attributes as $key => $attribute) {
                if (in_array($key, $this->dataAttributes)) {
                    $val = Yii::$app->formatter->asDatetime($model->{$key}, 'short');
                } else {
                    $val = $model->{$key};
                }

                $this->subject = str_replace('{' . $key . '}', $val, $this->subject);
                $this->user_subject = str_replace('{' . $key . '}', $val, $this->user_subject);
                $this->text = str_replace('{' . $key . '}', $val, $this->text);
                $this->user_text = str_replace('{' . $key . '}', $val, $this->user_text);
            }
        }

        $table = EmailDetailView::widget([
            'model' => $model,
            'attributes' => $model::$emailAttributes
        ]);

        $this->text = str_replace('{table}', $table, $this->text);
        $this->user_text = str_replace('{table}', $table, $this->user_text);

    }
194563
public function needsUserFile(Model $model)
    {
        return ! $this->files->exists($this->modelPath($model)) && $model->usesBaseFiles();
    }
719215
protected function getModelInstanceQuery(Model $model)
    {
        $query = $model->query();

        $this->applyOrderingToModelInstanceQuery($query);
        $this->applyStartAndStopLimitsToQuery($query);

        return $query;
    }
848929
protected function getModelPermissions($model)
    {
        $tree = $this->treeBuilder->getTree();
        $psrClass = '';
        if (is_string($model)) {
            $psrClass = $model;
        } elseif (is_object($model)) {
            $psrClass = get_class($model);
        }

        if (!empty($tree['models']) && array_key_exists($psrClass, $tree['models'])) {
            return $tree['models'][$psrClass];
        }

        return [];
    }
681126
protected function getScopeConstraints(Model $model)
    {
        $builder = $model->newQueryWithoutScopes();

        $this->apply($builder, $model);

        return (array) $builder->getQuery()->wheres;
    }
564347
public function setAssociationCounts(Model $model) {
        $counts = array();

        foreach (array($model->hasMany, $model->hasAndBelongsToMany) as $property) {
            foreach ($property as $alias => $assoc) {
                $class = isset($assoc['with']) ? $assoc['with'] : $assoc['className'];

                $counts[$alias] = Admin::introspectModel($class)->find('count', array(
                    'conditions' => array($assoc['foreignKey'] => $model->id),
                    'contain' => false
                ));
            }
        }

        $this->Controller->set('counts', $counts);
    }
284207
protected function handleGetDefault(Request $request, $model)
    {
        $total = null;
        if (empty($request->id)) {
            if (!empty($request->filter)) {
                $model = $this->handleFilterRequest($request->filter, $model);
            }
            if (!empty($request->sort)) {
                //if sorting AND paginating, get total count before sorting!
                if ($request->pageNumber) {
                    $total = $model->count();
                }
                $model = $this->handleSortRequest($request->sort, $model);
            }
        } else {
            $model = $model->where($model->getKeyName(), '=', $request->id);
        }

        try {
            if ($request->pageNumber && empty($request->id)) {
                $results = $this->handlePaginationRequest($request, $model, $total);
            } else {
                $results = $model->get();
            }
        } catch (\Illuminate\Database\QueryException $e) {
            throw new Exception(
                'Database Request Failed',
                static::ERROR_SCOPE | static::ERROR_UNKNOWN_ID,
                BaseResponse::HTTP_INTERNAL_SERVER_ERROR,
                array('detail' => $e->getMessage())
            );
        }
        return $results;
    }
932768
public function getText($model = null)
    {
        $text = (is_callable($this->text) && is_object($model)) ? call_user_func($this->text, $model) : $this->text;

        $title = null;
        if (is_callable($this->title) && is_object($model)) {
            $title = call_user_func($this->title, $model);
        } elseif ($this->title !== null) {
            $title = $this->title;
        } else {
            $title = $text;
        }

        if (! $this->hideTitle) {
            $this->setHtmlAttributes([
                'title' => $title,
                'data-toggle' => 'tooltip',
            ]);
        }

        $this->setHtmlAttributes([
            'class' => $this->class,
        ]);

        return $text;
    }
1245463
public function actionModel($model = null)
    {
        if (!$model) {
            $model = $this->prompt('Namespaced path to the ngrest model (e.g. "app\models\Users"):');
        }
        $object = Yii::createObject(['class' => $model]);
        
        if (!$object instanceof NgRestModelInterface) {
            throw new Exception("Model must be instance of NgRestModelInterface.");
        }
        
        $reflector = new \ReflectionClass($model);
        $fileName = $reflector->getFileName();
        $path = dirname($fileName);
        $apiEndpoint = $object->ngrestApiEndpoint();
        $i18n = !empty($object->i18n);
        $data = [
            'path' =>  $path,
            'fileName' => basename($fileName),
            'content' => $this->generateModelContent(
                $reflector->getNamespaceName(),
                $reflector->getShortName(),
                $apiEndpoint,
                Yii::$app->db->getTableSchema($object->tableName(), true),
                $i18n
             ),
        ];
        
        $this->generateFile($data);
    }
380008
function(model) {
			if (model === this._model) { return; }
			model = model || new mTextModel.TextModel();
			this._model.removeEventListener("preChanging", this._modelListener.onChanging); //$NON-NLS-1$
			this._model.removeEventListener("postChanged", this._modelListener.onChanged); //$NON-NLS-1$
			var oldLineCount = this._model.getLineCount();
			var oldCharCount = this._model.getCharCount();
			var newLineCount = model.getLineCount();
			var newCharCount = model.getCharCount();
			var newText = model.getText();
			var e = {
				type: "ModelChanging", //$NON-NLS-1$
				text: newText,
				start: 0,
				removedCharCount: oldCharCount,
				addedCharCount: newCharCount,
				removedLineCount: oldLineCount,
				addedLineCount: newLineCount
			};
			this.onModelChanging(e);
			this._model = model;
			e = {
				type: "ModelChanged", //$NON-NLS-1$
				start: 0,
				removedCharCount: oldCharCount,
				addedCharCount: newCharCount,
				removedLineCount: oldLineCount,
				addedLineCount: newLineCount
			};
			this.onModelChanged(e); 
			this._model.addEventListener("preChanging", this._modelListener.onChanging); //$NON-NLS-1$
			this._model.addEventListener("postChanged", this._modelListener.onChanged); //$NON-NLS-1$
			this._reset();
			this._update();
		}
518471
public function check($model)
    {
        list($min, $max) = $this->range;

        return $model->{$this->property} >= $min && $model->{$this->property} <= $max;
    }
919423
protected function rankWeights(Model $model)
    {
        $weights = $this->option($model, 'rank.weights');

        if (! is_array($weights) || count($weights) !== 4) {
            return '';
        }

        return '{'.implode(',', $weights).'}';
    }
925638
public function isOpenNode($model)
    {
        $isOpen = false;

        if ($openedIds = (array)$this->openedIds) {
            if (in_array($model->id, $openedIds)) {
                $isOpen = true;
            }
        }

        return $isOpen;
    }
1203944
public function render(Model $model, $source)
    {
        $count = $this->getCount(
            $this->getActualNestedRelation($model, $source)
        );

        if ( ! $count) {
            return '<span class="relation-count count-empty">&nbsp;</span>';
        }

        return '<span class="relation-count">' . $count . '</span>';
    }