本文整理汇总了PHP中Sections::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::model方法的具体用法?PHP Sections::model怎么用?PHP Sections::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::model方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasAccess
/**
* Check user's access to storage
* @param $id
* @param $rowType
* @return bool
*/
public static function hasAccess($id, $rowType)
{
$id = intval($id);
if ($rowType == 'storage') {
$condition = new CDbCriteria();
$condition->condition = "t.Storage_ID = '" . $id . "'";
$condition->addCondition("(t.Created_By = '" . Yii::app()->user->userID . "' OR t.Access_Type = '" . self::HAS_ACCESS . "')");
$condition->addCondition("t.Client_ID = '" . Yii::app()->user->clientID . "'");
if (Yii::app()->user->projectID != 'all') {
$condition->addCondition("t.Project_ID = '" . Yii::app()->user->projectID . "'");
}
$storage = Storages::model()->find($condition);
if ($storage) {
return true;
}
} else if ($rowType == 'section') {
$condition = new CDbCriteria();
$condition->join = "LEFT JOIN storages ON storages.Storage_ID = t.Storage_ID";
$condition->condition = "t.Section_ID = '" . $id . "'";
$condition->addCondition("(storages.Created_By = '" . Yii::app()->user->userID . "' OR storages.Access_Type = '" . self::HAS_ACCESS . "')");
$condition->addCondition("(t.Created_By = '" . Yii::app()->user->userID . "' OR t.Access_Type = '1')");
$condition->addCondition("storages.Client_ID = '" . Yii::app()->user->clientID . "'");
if (Yii::app()->user->projectID != 'all') {
$condition->addCondition("storages.Project_ID = '" . Yii::app()->user->projectID . "'");
}
$section = Sections::model()->find($condition);
if ($section) {
return true;
}
} else if ($rowType == 'subsection') {
$condition = new CDbCriteria();
$condition->join = "LEFT JOIN sections ON sections.Section_ID = t.Section_ID
LEFT JOIN storages ON storages.Storage_ID = sections.Storage_ID";
$condition->condition = "t.Subsection_ID = '" . $id . "'";
$condition->addCondition("(storages.Created_By = '" . Yii::app()->user->userID . "' OR storages.Access_Type = '" . self::HAS_ACCESS . "')");
$condition->addCondition("(sections.Created_By = '" . Yii::app()->user->userID . "' OR sections.Access_Type = '" . self::HAS_ACCESS . "')");
$condition->addCondition("(t.Created_By = '" . Yii::app()->user->userID . "' OR t.Access_Type = '" . self::HAS_ACCESS . "')");
$condition->addCondition("storages.Client_ID = '" . Yii::app()->user->clientID . "'");
if (Yii::app()->user->projectID != 'all') {
$condition->addCondition("storages.Project_ID = '" . Yii::app()->user->projectID . "'");
}
$subsection = Subsections::model()->find($condition);
if ($subsection) {
return true;
}
}
return false;
}
示例2: getLibraryFolderNames
/**
* Get library folder names for Data Entry autocomplete
* @param $projectID
* @return array
*/
public static function getLibraryFolderNames($projectID)
{
$folderNames = array();
$condition = new CDbCriteria();
$condition->join = "LEFT JOIN storages ON storages.Storage_ID = t.Storage_ID";
$condition->condition = "t.Folder_Cat_ID = '" . Sections::PATTY_CASH . "'";
$condition->addCondition("storages.Project_ID = '" . $projectID . "'");
$folders = Sections::model()->findAll($condition);
foreach ($folders as $folder) {
$folderNames[] = CHtml::encode($folder->Section_Name);
}
$folderNames = array_unique($folderNames);
return $folderNames;
}
示例3: checkDocumentAccordanceToSection
/**
* Check document Accordance To Section
* @param $sectionID
* @param $docId
* @return int
*/
public static function checkDocumentAccordanceToSection($sectionID, $docId)
{
$result = 0;
$document = Documents::model()->findByPk($docId);
$section = Sections::model()->with('folder_type')->findByPk($sectionID);
if ($document && $section) {
if (stripos($section->folder_type->Category_Doc_Types, $document->Document_Type) !== false) {
$result = 1;
}
}
return $result;
}