Ejemplo n.º 1
0
 protected function setTopic()
 {
     if (!array_key_exists($this->entity->getXmlId(), self::$topics)) {
         $dbRes = \CForumTopic::getList(null, array("FORUM_ID" => $this->forum["ID"], "XML_ID" => $this->entity->getXmlId()));
         self::$topics[$this->entity->getXmlId()] = ($res = $dbRes->fetch()) && $res ? $res : null;
     }
     $this->topic = self::$topics[$this->entity->getXmlId()];
     return $this;
 }
Ejemplo n.º 2
0
            $arRecord["URL"]["TASK"] = CHTTP::urlAddParams($arRecord["URL"]["TASK"], array('USER_ID' => $targetUserId));
            if (isset($arRecord['PARAMETERS']['AccessControl']) && $arRecord['PARAMETERS']['AccessControl'] == 'Y') {
                $arRecord["DESCRIPTION"] = '';
            }
        }
        $aActions = array(array("ICONCLASS" => "edit", "DEFAULT" => true, "TEXT" => GetMessage("BPTL_C_DETAIL"), "ONCLICK" => "window.location='" . $arRecord["URL"]["TASK"] . "';"));
        if (strlen($arRecord["DOCUMENT_URL"]) > 0) {
            $aActions[] = array("ICONCLASS" => "", "DEFAULT" => false, "TEXT" => GetMessage("BPTL_C_DOCUMENT"), "ONCLICK" => "window.open('" . $arRecord["DOCUMENT_URL"] . "');");
        }
        $arResult["RECORDS"][] = array("data" => $arRecord, "actions" => $aActions, "columns" => $aCols, "editable" => $arRecord['STATUS'] == CBPTaskStatus::Running);
    }
    $arResult["COMMENTS_COUNT"] = array();
    if ($useComments) {
        $workflows = array_unique($workflows);
        if ($workflows) {
            $iterator = CForumTopic::getList(array(), array("@XML_ID" => $workflows));
            while ($row = $iterator->fetch()) {
                $arResult["COMMENTS_COUNT"][$row['XML_ID']] = $row['POSTS'];
            }
        }
    }
    $arResult["ROWS_COUNT"] = $dbRecordsList->SelectedRowsCount();
    $arResult["NAV_STRING"] = $dbRecordsList->GetPageNavStringEx($navComponentObject, GetMessage("INTS_TASKS_NAV"), "", false);
    $arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
    $arResult["NAV_RESULT"] = $dbRecordsList;
}
if ($arParams["SHOW_TRACKING"] == "Y") {
    $arResult["H_GRID_ID"] = "bizproc_tasksListH_" . $currentUserId;
    $hgridOptions = new CGridOptions($arResult["H_GRID_ID"]);
    $hgridColumns = $hgridOptions->GetVisibleColumns();
    $hgridSort = $hgridOptions->GetSorting(array("sort" => array("ID" => "desc")));
Ejemplo n.º 3
0
 public function executeComponent()
 {
     if (!empty($this->arParams['ERROR'])) {
         ShowError(array_shift($this->arParams['ERROR']));
         return;
     }
     $this->arResult['USER_ID'] = $this->arParams['USER_ID'];
     $this->arResult['GRID_ID'] = 'lists_processes';
     $selectFields = array('ID', 'IBLOCK_TYPE_ID', 'IBLOCK_ID', 'NAME');
     $gridOptions = new CGridOptions($this->arResult['GRID_ID']);
     $gridColumns = $gridOptions->getVisibleColumns();
     $gridSort = $gridOptions->getSorting(array('sort' => array('ID' => 'desc')));
     $this->arResult['HEADERS'] = array(array("id" => "ID", "name" => "ID", "default" => false, "sort" => "ID"), array('id' => 'DOCUMENT_NAME', 'name' => Loc::getMessage('CC_BLL_DOCUMENT_NAME'), 'default' => true, 'sort' => 'DOCUMENT_NAME'), array('id' => 'COMMENTS', 'name' => Loc::getMessage('CC_BLL_COMMENTS'), 'default' => true, 'sort' => '', 'hideName' => true, 'iconCls' => 'bp-comments-icon'), array('id' => 'WORKFLOW_PROGRESS', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_PROGRESS'), 'default' => true, 'sort' => ''), array('id' => 'WORKFLOW_STATE', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_STATE'), 'default' => false, 'sort' => ''));
     $this->arResult['FILTER'] = array(array("id" => "NAME", "name" => GetMessage("BPATL_NAME"), "type" => "string"), array('id' => 'TIMESTAMP_X', 'name' => Loc::getMessage('CC_BLL_MODIFIED'), 'type' => 'date'), array('id' => 'DATE_CREATE', 'name' => Loc::getMessage('CC_BLL_CREATED'), 'type' => 'date', 'default' => true));
     $gridFilter = $gridOptions->getFilter($this->arResult['FILTER']);
     foreach ($gridFilter as $key => $value) {
         if (substr($key, -5) == "_from") {
             $op = ">=";
             $newKey = substr($key, 0, -5);
         } elseif (substr($key, -3) == "_to") {
             $op = "<=";
             $newKey = substr($key, 0, -3);
             if (in_array($newKey, array("TIMESTAMP_X", 'DATE_CREATE'))) {
                 if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
                     $value .= " 23:59:59";
                 }
             }
         } else {
             $op = "";
             $newKey = $key;
         }
         $filter[$op . $newKey] = $value;
     }
     $this->arResult['SORT'] = $gridSort['sort'];
     $useComments = (bool) CModule::includeModule("forum");
     $workflows = array();
     $this->arResult['DATA'] = array();
     $this->arResult["COMMENTS_COUNT"] = array();
     $filter['CREATED_BY'] = $this->arParams['USER_ID'];
     $iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
     $filter['IBLOCK_TYPE'] = $iblockTypeId;
     $filter['CHECK_PERMISSIONS'] = $this->arParams['LIST_PERM'] >= CListPermissions::CAN_READ ? "N" : "Y";
     $elementObject = CIBlockElement::getList($gridSort['sort'], $filter, false, $gridOptions->getNavParams(), $selectFields);
     $documentState = true;
     $path = rtrim(SITE_DIR, '/');
     while ($element = $elementObject->fetch()) {
         $documentState = CBPDocument::GetDocumentStates(BizprocDocument::generateDocumentComplexType($iblockTypeId, $element['IBLOCK_ID']), BizprocDocument::getDocumentComplexId($iblockTypeId, $element['ID']));
         $this->arResult['DATA'][$element['ID']]['ID'] = $element['ID'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_NAME'] = $element['NAME'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_URL'] = $path . COption::GetOptionString('lists', 'livefeed_url') . '?livefeed=y&list_id=' . $element["IBLOCK_ID"] . '&element_id=' . $element['ID'];
         if (!empty($documentState)) {
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = true;
             $documentState = current($documentState);
             $this->arResult['DATA'][$element['ID']]['WORKFLOW_ID'] = $documentState['ID'];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_NAME"] = $documentState["TEMPLATE_NAME"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STATE"] = $documentState["STATE_TITLE"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED"] = FormatDateFromDB($documentState["STARTED_FORMATTED"]);
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = "";
             if (intval($documentState["STARTED_BY"]) > 0) {
                 $dbUserTmp = CUser::getByID($documentState["STARTED_BY"]);
                 $arUserTmp = $dbUserTmp->fetch();
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = CUser::FormatName($this->arParams["NAME_TEMPLATE"], $arUserTmp, true);
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] .= " [" . $documentState["STARTED_BY"] . "]";
             }
             $this->arResult['DATA'][$element['ID']]['MODULE_ID'] = $documentState["DOCUMENT_ID"][0];
             $this->arResult['DATA'][$element['ID']]['ENTITY'] = $documentState["DOCUMENT_ID"][1];
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_ID'] = $documentState["DOCUMENT_ID"][2];
         } else {
             $documentState = false;
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = false;
         }
     }
     foreach ($this->arResult['DATA'] as $data) {
         if ($documentState) {
             if ($useComments) {
                 $workflows[] = 'WF_' . $data['WORKFLOW_ID'];
             }
         }
         $actions = array();
         if (strlen($data["DOCUMENT_URL"]) > 0) {
             $actions[] = array('ICONCLASS' => '', 'DEFAULT' => false, 'TEXT' => Loc::getMessage('CC_BLL_C_DOCUMENT'), 'ONCLICK' => 'window.open("' . $data["DOCUMENT_URL"] . '");');
         }
         $this->arResult['RECORDS'][] = array('data' => $data, 'actions' => $actions);
     }
     if ($useComments && $documentState) {
         $workflows = array_unique($workflows);
         if ($workflows) {
             $iterator = CForumTopic::getList(array(), array("@XML_ID" => $workflows));
             while ($row = $iterator->fetch()) {
                 $this->arResult["COMMENTS_COUNT"][$row['XML_ID']] = $row['POSTS'];
             }
         }
     }
     $this->arResult['COUNTERS'] = array('all' => 0);
     $this->arResult["ROWS_COUNT"] = $elementObject->selectedRowsCount();
     $this->arResult["NAV_RESULT"] = $elementObject;
     if ($this->arParams['SET_TITLE'] == 'Y') {
         $this->getApplication()->setTitle(Loc::getMessage('CC_BLL_TITLE'));
     }
     $this->includeComponentTemplate();
 }
Ejemplo n.º 4
0
 protected function getCommentsProcess($elementId)
 {
     $countComments = 0;
     $this->arResult["ELEMENTS_HEADERS"]["COMMENTS"] = Loc::getMessage("CC_BLL_COMMENTS");
     if (!$this->arResult["BIZPROC"] || !$elementId) {
         return $countComments;
     }
     $documentStates = CBPDocument::GetDocumentStates(BizProcDocument::generateDocumentComplexType($this->arParams["IBLOCK_TYPE_ID"], $this->arResult["IBLOCK_ID"]), BizProcDocument::getDocumentComplexId($this->arParams["IBLOCK_TYPE_ID"], $elementId));
     if (!empty($documentStates)) {
         $state = current($documentStates);
     } else {
         return $countComments;
     }
     $query = CForumTopic::getList(array(), array("@XML_ID" => 'WF_' . $state["ID"]));
     while ($row = $query->fetch()) {
         $countComments = $row["POSTS"];
     }
     return $countComments;
 }