Код с /system/controllers/users/widgets/content/widget.php
<?php class widgetUsersContent extends cmsWidget { public function run(){ $user = cmsUser::getInstance(); if (!$user->id) { return false; } $content_counts = cmsCore::getModel('content')->getUserContentCounts($user->id, false); if (!$content_counts) { return false; } 'user' => $user, 'content' => $content_counts ); } }
<?php $this->addHead('<style> ul.users_wgt_content{list-style:none;margin:0;} ul.users_wgt_content a{text-decoration:none;} .users_wgt_content li div:last-child{float:right;height:32px;} .users_wgt_content li div:first-child{float:left;} .users_wgt_content li{height:32px;line-height:32px;border-bottom:solid 1px gainsboro;padding-left:5px;clear:both;} .users_wgt_content li:hover{background:#f0f0f0;} .users_wgt_content span{margin-left:5px;background-color:#4da134;color:white;padding:2px 6px;border-radius:10px;font-size:12px;} .users_wgt_content li div:last-child a{padding:0px 8px;font-size:23px;} </style>'); ?> <?php if ($content) { ?> <ul class="users_wgt_content"> <?php foreach ($content as $key => $value): ?> <li> <div><a href="<?php echo href_to('users',$user->id,array('content',$key)); ?>"><?php echo $value['title']; ?></a><span><?php echo $value['count']; ?></span></div> <div><a href="<?php echo href_to($key,'add'); ?>">+</a></div> </li> <?php endforeach ?> </ul> <?php } ?>