Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #46 from okulbilisim/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
hmert committed Nov 29, 2014
2 parents b64240a + 5e6c559 commit a47f4cf
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 39 deletions.
4 changes: 4 additions & 0 deletions docs/developers/SampleData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@todo

https://github.com/nelmio/alice
https://github.com/fzaninotto/Faker
12 changes: 12 additions & 0 deletions src/Ojs/CliBundle/Command/Jobs/CountJournalsForSubjectsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln("<info>Counting all journals grouped by Subjects</info>\n");
$kernel = $this->getContainer()->get('kernel');
$application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);

$doctrine = $this->getContainer()->get('doctrine');
$em = $doctrine->getManager();
$subjects = $em->getRepository('OjsJournalBundle:Subject')->findAll();

foreach ($subjects as $subject) {
$count = $subject->getJournals()->count();
$subject->setTotalJournalCount($count);
$em->persist($subject);
$em->flush();
echo ".";
}
$application->setAutoExit(false);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Ojs/CliBundle/Command/SampleDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
$output->writeln('<info>Adding fake data</info>');
$application->run(new \Symfony\Component\Console\Input\StringInput('h4cc_alice_fixtures:load:sets'));
$output->writeln('<info>Recalculating precalculated fields</info>');
$application->run(new \Symfony\Component\Console\Input\StringInput('ojs:count:journals:subjects'));
$output->writeln("\nDONE\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@

$set->addFile(__DIR__ . '/a_file.yml', 'yaml'); //Article File

$set->addFile(__DIR__ . '/theme.yml', 'yaml'); //themes

return $set;
3 changes: 2 additions & 1 deletion src/Ojs/JournalBundle/DataFixtures/Alice/journal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
journal{1..50}:
issn: <regexify('\d{4}-\d{4}')>
mission: <text(50)>
slug (unique): <domainWord()>
period: <randomDigit(2)>
published: '1'
scope: <text(50)>
Expand All @@ -10,7 +11,7 @@
titleAbbr: <text(5)>
titleTransliterated: null
url: <url()>
subdomain: <domainWord()>
subdomain (unique): <domainWord()>
institution: @institution*
subject: 5x @subject*
status: '3'
Expand Down
2 changes: 1 addition & 1 deletion src/Ojs/JournalBundle/DataFixtures/Alice/subject.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
subject{Anatomi ve Fizyoloji, Antropoloji,Askeri Tarih ve Bilim,Astronomi ve Astrofizik,Beslenme ve Diyetetik,Bilgi Teknolojileri,Bilgisayar Bilimleri,Biyografi,Biyoloji,Biyoteknoloji,Botanik,Çevre Bilimleri,Coğrafya ve Harita Bilimi,Dans,Denizbilim,Dil Bilimi,Din ve Felsefe,Diplomasi ve Uluslararası İlişkiler,Diş Hekimliği,Drama ve Sahne Sanatları,Eczacılık ve İlaç Bilimi,Edebiyat,Eğitim,Etnik ve Kültürel Çalışmalar,Fen Bilimleri,Film,Fizik,Fizik Tedavi ve Rehabilitasyon,Görsel Sanatlar,Güç ve Enerji,Halk Sağlığı,Hemşirelik ve Tamamlayıcı Sağlık Bilimleri,Hukuk,İktisat,İletişim ve Medya,İşletme ve Yönetim,Jeoloji,Kadın Çalışmaları ve Feminizm,Kimya,Kütüphane ve Enformasyon Bilimi,Madencilik ve Mineral Kaynakları,Matematik,Mimarlık,Mühendislik,Müzik,Ormancılık,Pazarlama,Politika ve Hükümet,Psikoloji,Sanat ve Eğlence,Siyaset Bilimi,Sosyal Çalışmalar,Sosyal ve Beşeri Bilimler,Sosyoloji,Spor Hekimliği,Spor ve Beden Eğitimi,Tamamlayıcı ve Alternatif Tıp,Tarih,Tarım ve Tarım Ticareti,Teknoloji,Tıp ve Sağlık Bilimleri,Tüketici Sağlığı,Uygulamalı Bilimler,Veterinerlik,Yapı ve İnşaat,Yaşam Bilimleri,Yer ve Atmosfer Bilimleri, Zooloji}:
subject: <current()>
createdBy: @user1->username
totalJournalCount: 0
totalJournalCount: <numberBetween(1,30)>
17 changes: 17 additions & 0 deletions src/Ojs/JournalBundle/DataFixtures/Alice/theme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\Ojs\JournalBundle\Entity\Theme:
theme_notpublic1:
name: demo_theme1
title: Demo Theme 1
isPublic: false
theme_notpublic2:
name: demo_theme2
title: Demo Theme 2
isPublic: false
theme_public1:
name: demo_public_theme1
title: Demo Public Theme 1
isPublic: true
theme_public2:
name: demo_public_theme2
title: Demo Public Theme 2
isPublic: true
38 changes: 34 additions & 4 deletions src/Ojs/JournalBundle/Entity/Journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ class Journal extends \Ojs\Common\Entity\GenericExtendedEntity implements Transl
*/
private $mission;

/**
* @var string
* @Expose
*/
private $slug;

/**
* @var integer
* @Expose
Expand Down Expand Up @@ -168,6 +174,7 @@ class Journal extends \Ojs\Common\Entity\GenericExtendedEntity implements Transl
* @var \Doctrine\Common\Collections\Collection
*/
private $pages;

/**
*
* arbitrary settings
Expand All @@ -191,6 +198,7 @@ class Journal extends \Ojs\Common\Entity\GenericExtendedEntity implements Transl
* @Expose
*/
private $institutionId;

/**
* @var \Doctrine\Common\Collections\Collection
*/
Expand Down Expand Up @@ -246,8 +254,8 @@ public function getPages()
public function removePage(\Ojs\WikiBundle\Entity\Page $page)
{
$this->pages->removeElement($page);

}

/**
* @param \Ojs\JournalBundle\Entity\JournalSection $section
* @return Journal
Expand All @@ -274,7 +282,7 @@ public function getSections()
return $this->sections;
}

/**
/**
* @param \Ojs\JournalBundle\Entity\JournalTheme $journalTheme
* @return Journal
*/
Expand Down Expand Up @@ -785,7 +793,30 @@ public function setMission($mission)
}

/**
* Get themeId
* Set slug
*
* @param string $slug
* @return Journal
*/
public function setSlug($slug)
{
$this->slug = $slug;

return $this;
}

/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}

/**
* Get theme
*
* @return integer
*/
Expand Down Expand Up @@ -989,5 +1020,4 @@ public function getBannedUsers()
return $this->bannedUsers;
}


}
2 changes: 1 addition & 1 deletion src/Ojs/JournalBundle/Form/JournalThemeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'property' => 'title',
'query_builder' => function(\Doctrine\ORM\EntityRepository $er) {
return $er->createQueryBuilder('t')
->where('t.isPublic IS NULL OR t.isPublic = TRUE');
->where('t.isPublic = FALSE');
})
)
;
Expand Down
1 change: 1 addition & 0 deletions src/Ojs/JournalBundle/Form/JournalType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('image')
->add('scope')
->add('mission')
->add('slug')
->add('themeId')
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ Ojs\JournalBundle\Entity\Journal:
nullable: true
gedmo:
- translatable
slug:
type: string
nullable: true
themeId:
type: integer
column: theme_id
Expand Down Expand Up @@ -236,4 +239,7 @@ Ojs\JournalBundle\Entity\Journal:
translation:
locale: locale
loggable: true
uniqueConstraints:
slugx:
columns: slug
lifecycleCallbacks: { }
62 changes: 32 additions & 30 deletions src/Ojs/ManagerBundle/Resources/views/Admin/dashboard.html.twig
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
{% extends "::ojsbase.html.twig" %}

{% block body %}
<h1>Admin Dashboard</h1>

<div class="col-md-6">
<a href="{{path("dashboard_editor")}}"><strong>Editor Dashboard</strong></a>

<h2>Objects</h2>

<ul class="list-group">

<li class="list-group-item"><a href="{{path('article')}}">Articles</a></li>
<li class="list-group-item"><a href="{{path('author')}}">Authors</a></li>
<li class="list-group-item"><a href="{{path('contact')}}">Contacts</a></li>
<li class="list-group-item"><a href="{{path('contacttypes')}}">Contact Types</a></li>
<li class="list-group-item"><a href="{{path('institution')}}">Institutions</a></li>
<li class="list-group-item"><a href="{{path('institution_types')}}">Institution Types</a></li>
<li class="list-group-item"><a href="{{path('issue')}}">Issues</a></li>
<li class="list-group-item"><a href="{{path('journal')}}">Journals</a></li>
<li class="list-group-item"><a href="{{path('subject')}}">Subjects</a></li>
<li class="list-group-item"><a href="{{path('theme')}}">Themes</a></li>
</ul>
</div>

<div class="col-md-6">
<h2>System Operations</h2>
<ul class="list-group">
<li class="list-group-item"><a href="{{path('user')}}">User</a></li>
<li class="list-group-item"><a href="{{path('role')}}">Role</a></li>

</ul>
</div>
<h1>Admin Dashboard</h1>

<div class="col-md-6">
<a href="{{path("dashboard_editor")}}"><strong>Editor Dashboard</strong></a>

<h2>Objects</h2>

<ul class="list-group">

<li class="list-group-item"><a href="{{path('article')}}">Articles</a></li>
<li class="list-group-item"><a href="{{path('author')}}">Authors</a></li>
<li class="list-group-item"><a href="{{path('contact')}}">Contacts</a></li>
<li class="list-group-item"><a href="{{path('contacttypes')}}">Contact Types</a></li>
<li class="list-group-item"><a href="{{path('institution')}}">Institutions</a></li>
<li class="list-group-item"><a href="{{path('institution_types')}}">Institution Types</a></li>
<li class="list-group-item"><a href="{{path('issue')}}">Issues</a></li>
<li class="list-group-item"><a href="{{path('journal')}}">Journals</a></li>
<li class="list-group-item"><a href="{{path('subject')}}">Subjects</a></li>
<li class="list-group-item"><a href="{{path('lang')}}">System Languages</a></li>
<li class="list-group-item"><a href="{{path('theme')}}">Themes</a></li>
<li class="list-group-item"><a href="{{path('admin_journaltheme')}}">Journal Themes</a></li>
</ul>
</div>

<div class="col-md-6">
<h2>System Operations</h2>
<ul class="list-group">
<li class="list-group-item"><a href="{{path('user')}}">Users</a></li>
<li class="list-group-item"><a href="{{path('role')}}">Roles</a></li>

</ul>
</div>

{% endblock %}
2 changes: 1 addition & 1 deletion src/Ojs/SiteBundle/Controller/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function journalsIndexAction(Request $request, $page = 1)
// TODO find only has journal(s) and count them
$subjects = $em->getRepository('OjsJournalBundle:Subject')->findAll();
foreach ($subjects as $subject) {
if ($subject->hasJournals()) {
if ($subject->getTotalJournalCount() > 0) {
$data["subjects"][] = $subject;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{% for subject in subjects %}
<li class="list-group-item">
<a href="{{ path("ojs_journals_index",{page: currentPage,filters: addFilters('subject',subject.id)}) }}">{{subject.subject}}</a>
<span class="label label-success pull-right">{{subject.journals.count}}</span>
<span class="label label-success pull-right">{{subject.totalJournalCount}}</span>
</li>
{% endfor %}
</ul>
Expand Down

0 comments on commit a47f4cf

Please sign in to comment.