Skip to content

Commit

Permalink
Merge pull request thinkingreed-inc#293 from K-Haruto:fix_Login_rssError
Browse files Browse the repository at this point in the history
RSSが取れないときにログイン画面を正常に表示させる修正
  • Loading branch information
Remicck committed Dec 1, 2021
1 parent 18c5d90 commit 4541bd0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion layouts/v7/modules/Users/Login.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
<div>
<h4>F-RevoCRMに関するお知らせ</h4>
</div>
<a href="https://f-revocrm.jp" target="_blank" style="margin-right: 25px;"><img src="https://f-revocrm.jp/frevowp/wp-content/uploads/2018/07/top_keyvisual-11-2.png" style="width: 85%; height: 100%; margin-top: 25px;"/></a>
<a href="https://f-revocrm.jp" target="_blank" style="margin-right: 25px;"><img src="https://f-revocrm.jp/frevowp/wp-content/uploads/2021/09/image_frevo_top.png" style="width: 85%; height: 100%; margin-top: 25px;"/></a>
</div>
{/if}
</div>
Expand Down
45 changes: 26 additions & 19 deletions modules/Users/views/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,33 @@ function preProcess(Vtiger_Request $request, $display = true) {
function process (Vtiger_Request $request) {
$finalJsonData = array();

$rssPath = "https://f-revocrm.jp/?feed=rss2";
$xml = new SimpleXMLElement($rssPath, LIBXML_NOCDATA, true);
$jsonData = json_decode(json_encode($xml));
try{
$rssPath = "https://f-revocrm.jp/?feed=rss2";
$xml = new SimpleXMLElement($rssPath, LIBXML_NOCDATA, true);
$jsonData = json_decode(json_encode($xml));
$dataCount = count($jsonData->channel->item);
}catch(Exception $e){
$dataCount = 0;
}

$oldTextLength = vglobal('listview_max_textlength');
foreach ($jsonData->channel->item as $item) {
$blockData = array();
$blockData['type'] = "news";
$blockData['heading'] = "Latest News";
// $blockData['image'] = $jsonData->channel->image->url;
$blockData['url'] = $item->link;
$blockData['urlalt'] = $item->link;
$blockData['pubDate'] = date('Y-m-d',strtotime($item->pubDate));

vglobal('listview_max_textlength', 80);
$blockData['displayTitle'] = textlength_check($item->title);

vglobal('listview_max_textlength', 200);
$blockData['displaySummary'] = textlength_check(strip_tags($item->description));
$finalJsonData[$blockData['type']][] = $blockData;
if(!empty($jsonData)){
foreach ($jsonData->channel->item as $item) {
$blockData = array();
$blockData['type'] = "news";
$blockData['heading'] = "Latest News";
// $blockData['image'] = $jsonData->channel->image->url;
$blockData['url'] = $item->link;
$blockData['urlalt'] = $item->link;
$blockData['pubDate'] = date('Y-m-d',strtotime($item->pubDate));

vglobal('listview_max_textlength', 80);
$blockData['displayTitle'] = textlength_check($item->title);

vglobal('listview_max_textlength', 200);
$blockData['displaySummary'] = textlength_check(strip_tags($item->description));
$finalJsonData[$blockData['type']][] = $blockData;
}
}
vglobal('listview_max_textlength', $oldTextLength);

Expand Down Expand Up @@ -83,7 +90,7 @@ function process (Vtiger_Request $request) {
// }

$viewer = $this->getViewer($request);
$viewer->assign('DATA_COUNT', count($jsonData->channel->item));
$viewer->assign('DATA_COUNT', $dataCount);
$viewer->assign('JSON_DATA', $finalJsonData);

$mailStatus = $request->get('mailStatus');
Expand Down

0 comments on commit 4541bd0

Please sign in to comment.