16 if (!is_array($params))
21 $subjectId = (isset($params[
'subjectId']) && intval($params[
'subjectId']) > 0 ? intval($params[
'subjectId']) :
false);
22 $groupSiteIdList = (isset($params[
'siteId']) && is_array($params[
'siteId']) && !empty($params[
'siteId']) ? $params[
'siteId'] : array());
24 foreach($groupSiteIdList as $key => $siteId)
28 unset($groupSiteIdList[$key]);
34 || empty($groupSiteIdList)
40 $subjectSiteList = array();
42 $res = WorkgroupSubjectSiteTable::getList(array(
44 'SUBJECT_ID' => $subjectId
46 'select' => array(
'SITE_ID')
49 while ($subjectSite = $res->fetch())
51 $subjectSiteList[] = $subjectSite[
'SITE_ID'];
54 $addSubjectSiteList = array_diff($groupSiteIdList, $subjectSiteList);
55 $addSubjectSiteList = array_unique($addSubjectSiteList);
57 if (!empty($addSubjectSiteList))
59 foreach ($addSubjectSiteList as $siteId)
61 WorkgroupSubjectSiteTable::add(array(
62 'SUBJECT_ID' => $subjectId,