Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 509648e

Browse files
author
Julien Jomier
committed
ENH: Fixing style issues
ENH: Added explore
1 parent 4b92c51 commit 509648e

21 files changed

+151
-73
lines changed

core/controllers/BrowseController.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,20 @@ function init()
2929
/** Index Action*/
3030
public function indexAction()
3131
{
32-
$communities = array();
3332
$items = array();
3433
$header = "";
3534

36-
if($this->logged && $this->userSession->Dao->isAdmin())
37-
{
38-
$communities = $this->Community->getAll();
39-
}
40-
else
41-
{
42-
$communities = $this->User->getUserCommunities($this->userSession->Dao);
43-
$communities = array_merge($communities, $this->Community->getPublicCommunities());
44-
}
45-
4635
$this->view->Date = $this->Component->Date;
4736

4837
$this->view->header = $this->t('Explore');
4938

50-
$this->view->itemThumbnails = $this->Item->getRandomItems($this->userSession->Dao, 0, 12, true);
39+
$this->view->itemThumbnails = $this->Item->getRandomThumbnails($this->userSession->Dao, 0, 12, true);
40+
41+
$this->view->items = $this->Item->getMostPopulars($this->userSession->Dao,30);
42+
5143
$this->view->nUsers = $this->User->getCountAll();
5244
$this->view->nCommunities = $this->Community->getCountAll();
5345
$this->view->nItems = $this->Item->getCountAll();
54-
$this->view->notifications = array();
5546

5647
$this->view->json['community']['titleCreateLogin'] = $this->t('Please log in');
5748
$this->view->json['community']['contentCreateLogin'] = $this->t('You need to be logged in to be able to create a community.');

core/controllers/FeedController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function init()
2929
public function indexAction()
3030
{
3131
$this->view->feeds = $this->Feed->getGlobalFeeds($this->userSession->Dao);
32-
$this->view->itemThumbnails = $this->Item->getRandomItems($this->userSession->Dao, 0, 12, true);
32+
$this->view->itemThumbnails = $this->Item->getRandomThumbnails($this->userSession->Dao, 0, 12, true);
3333
$this->view->nUsers = $this->User->getCountAll();
3434
$this->view->nCommunities = $this->Community->getCountAll();
3535
$this->view->nItems = $this->Item->getCountAll();

core/controllers/FolderController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ public function viewAction()
126126
}
127127
$parent = $parent->getParent();
128128
}
129-
$header = "<ul class = 'pathBrowser'>
130-
<li class = 'pathData'><a href = '".$this->view->webroot."/browse'>".$this->t('Data')."</a></li>".$header;
129+
$header = "<ul class = 'pathBrowser'>".$header;
131130
$header .= "</ul>";
132131
}
133132

core/models/base/ItemModelBase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ abstract function getSharedToUser($userDao, $limit = 20);
4646
abstract function getSharedToCommunity($communityDao, $limit = 20);
4747
abstract function policyCheck($itemdao, $userDao = null, $policy = 0);
4848
abstract function getLastRevision($itemdao);
49+
abstract function getMostPopulars($userDao, $limit=20);
50+
abstract function getRandomThumbnails($userDao = null, $policy = 0, $limit = 10, $thumbnailFilter = false);
4951

5052
/** save */
5153
public function save($dao)

core/models/pdo/ItemModel.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,30 @@ function getSharedToCommunity($communityDao, $limit = 20)
5252
return $results;
5353
}//end getSharedToCommunity
5454

55+
/**
56+
* Get most popular items
57+
* @param type $limit
58+
* @return Array
59+
*/
60+
function getMostPopulars($userDao, $limit=20)
61+
{
62+
$sql = $this->database->select()
63+
->setIntegrityCheck(false)
64+
->from(array('i' => 'item'))
65+
->where('privacy_status = ?', MIDAS_PRIVACY_PUBLIC)
66+
->order(array('i.view DESC'))
67+
->limit($limit);
68+
$rowset = $this->database->fetchAll($sql);
69+
$results = array();
70+
foreach($rowset as $row)
71+
{
72+
$tmp = $this->initDao('Item', $row);
73+
$results[] = $tmp;
74+
}
75+
return $results;
76+
}
77+
78+
5579
/**
5680
* Get Items where user policy = Admin
5781
* @param type $userDao
@@ -248,7 +272,7 @@ function policyCheck($itemdao, $userDao = null, $policy = 0)
248272
* @param type $limit
249273
* @return array of ItemDao
250274
*/
251-
function getRandomItems($userDao = null, $policy = 0, $limit = 10, $thumbnailFilter = false)
275+
function getRandomThumbnails($userDao = null, $policy = 0, $limit = 10, $thumbnailFilter = false)
252276
{
253277
if($userDao == null)
254278
{

core/public/css/browse/browse.index.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,38 @@ div.feedThumbnail img{
88
margin-right: 4px;
99
}
1010

11+
.itemSubTitle{
12+
margin-top: 0px;
13+
margin-bottom: 5px;
14+
}
15+
16+
1117
div.feedThumbnail a{
1218
border: 0px;
19+
}
20+
21+
div.itemList{
22+
23+
}
24+
25+
div.itemList span{
26+
padding-left: 15px;
27+
}
28+
29+
div.itemBlock {
30+
padding-top: 5px;
31+
padding-bottom: 5px;
32+
border-bottom: 1px dotted grey;
33+
}
34+
35+
div.itemBlock:hover{
36+
background-color: #F6F9FE;
37+
cursor: pointer;
38+
}
39+
40+
div.itemStats {
41+
float: right;
42+
font-size: 10px;
43+
border: none;
44+
color: #777777;
1345
}

core/public/css/common/common.browser.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
ul.pathBrowser{
77
display: block;
88
list-style-type: disc;
9-
margin: 0;
9+
margin: 0px;
1010
padding-left: 0px;
1111
float: left;
1212
-webkit-margin-before: 0em;
@@ -21,9 +21,9 @@ ul.pathBrowser li{
2121
list-style: none;
2222
float: left;
2323
background-repeat: no-repeat;
24-
background-position: right 0px;
24+
background-position: right -3px;
2525
display: list-item;
26-
padding: 3px 22px 7px 3px;
26+
padding: 0px 22px 7px 3px;
2727
text-shadow: 0px 1px 0px #EEE;
2828
background-image: url("../../images/icons/path-divider.png");
2929
}

core/public/css/common/common.genericPage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ div.genericInfo .genericName{
4545
font-size: 16px;
4646
}
4747

48-
div.genericInfo .genericCompany{
48+
div.genericInfo .genericSubtitle{
4949
font-weight: bold;
5050
}

core/public/css/community/community.index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ div.communityList span{
2020
div.communityBlock:hover{
2121
background-color: #F6F9FE;
2222
cursor: pointer;
23-
}
23+
}

core/public/css/community/community.view.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,24 @@ div.viewSideBar input.globalButton{
55
.genericInfo {
66
margin-top: 5px;
77
margin-left: 35px;
8+
}
9+
10+
div.genericInfo .genericSubtitle {
11+
font-weight: normal;
12+
}
13+
14+
div.genericBigButton input{
15+
border: none;
16+
cursor: pointer;
17+
background-color: #ffffff;
18+
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#c4c4c4));
19+
background-image: -moz-linear-gradient(center top, #ffffff 0%, #c4c4c4 100% );
20+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#c4c4c4');
21+
}
22+
23+
div.genericBigButton input:hover{
24+
background-color: #bddcc9;
25+
background-image: -webkit-gradient(linear, left top, left bottom, from(#bddcc9), to(#8ab79b));
26+
background-image: -moz-linear-gradient(center top, #bddcc9 0%, #8ab79b 100% );
27+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bddcc9', endColorstr='#8ab79b');
828
}

0 commit comments

Comments
 (0)