last progress
This commit is contained in:
parent
52ae369553
commit
64c13428d3
BIN
hesabixArchive/temp/140050100014298555-0-655d1b5c85662.pdf
Normal file
BIN
hesabixArchive/temp/140050100014298555-0-655d1b5c85662.pdf
Normal file
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -176,6 +176,35 @@ class AdminController extends AbstractController
|
|||
}
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
#[Route('/api/admin/settings/system/info', name: 'admin_settings_system_info')]
|
||||
public function admin_settings_system_info(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(Settings::class)->findAll()[0];
|
||||
$resp = [];
|
||||
$resp['keywords'] = $item->getSiteKeywords();
|
||||
$resp['description'] = $item->getDiscription();
|
||||
return $this->json($resp);
|
||||
}
|
||||
|
||||
#[Route('/api/admin/settings/system/info/save', name: 'admin_settings_system_info_save')]
|
||||
public function admin_settings_system_info_save(EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(array_key_exists('keywords',$params) && array_key_exists('description',$params)){
|
||||
$item = $entityManager->getRepository(Settings::class)->findAll()[0];
|
||||
$item->setSiteKeywords($params['keywords']);
|
||||
$item->setDiscription($params['description']);
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
return $this->json(['result' => 1]);
|
||||
}
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
#[Route('/api/admin/reportchange/lists', name: 'app_admin_reportchange_list')]
|
||||
public function app_admin_reportchange_list(Jdate $jdate,Provider $provider,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
|
|
|
@ -232,7 +232,7 @@ class ArchiveController extends AbstractController
|
|||
}
|
||||
|
||||
#[Route('/api/archive/file/upload', name: 'app_archive_file_upload')]
|
||||
public function app_archive_file_upload(Jdate $jdate, Provider $provider,SluggerInterface $slugger,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): Response
|
||||
public function app_archive_file_upload(Jdate $jdate, Provider $provider,SluggerInterface $slugger,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('archiveUpload');
|
||||
if (!$acc)
|
||||
|
@ -247,21 +247,30 @@ class ArchiveController extends AbstractController
|
|||
$newFilename = $safeFilename.'-'.uniqid().'.'.$uploadedFile->guessExtension();
|
||||
|
||||
// Move the file to the directory where brochures are stored
|
||||
|
||||
try {
|
||||
$uploadedFile->move(
|
||||
$this->getParameter('archiveTempMediaDir'),
|
||||
$newFilename
|
||||
);
|
||||
try {} catch (FileException $e) {
|
||||
);} catch (FileException $e) {
|
||||
// ... handle exception if something happens during file upload
|
||||
}
|
||||
|
||||
// updates the 'brochureFilename' property to store the PDF file name
|
||||
// instead of its contents
|
||||
//$product->setBrochureFilename($newFilename);
|
||||
return new Response('ali.jpg');
|
||||
return $this->json(['name'=>$newFilename]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#[Route('/api/archive/file/save', name: 'app_archive_file_save')]
|
||||
public function app_archive_file_save(Jdate $jdate, Provider $provider,SluggerInterface $slugger,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('archiveUpload');
|
||||
if (!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
return $this->json([
|
||||
'ok'=>$request->get('doctype')
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,14 +44,14 @@ class BlogController extends AbstractController
|
|||
$comment = new BlogComment();
|
||||
$form = $this->createForm(CommentType::class,$comment);
|
||||
$form->handleRequest($request);
|
||||
if($form->isSubmitted() && $form->isValid() && $this->getUser()){
|
||||
if($form->isSubmitted() && $form->isValid()){
|
||||
echo 11;
|
||||
$oldComments = $entityManager->getRepository(BlogComment::class)->findBy([
|
||||
'submitter'=>$this->getUser()
|
||||
'email'=>$comment->getEmail()
|
||||
],['id'=>'DESC']);
|
||||
if(count($oldComments) == 0){
|
||||
$comment->setDateSubmit(time());
|
||||
$comment->setPost($item);
|
||||
$comment->setSubmitter($this->getUser());
|
||||
$entityManager->persist($comment);
|
||||
$entityManager->flush();
|
||||
$comment->setBody('');
|
||||
|
|
|
@ -14,10 +14,6 @@ class BlogComment
|
|||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'blogComments')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $submitter = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $dateSubmit = null;
|
||||
|
||||
|
@ -45,18 +41,6 @@ class BlogComment
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
public function getSubmitter(): ?User
|
||||
{
|
||||
return $this->submitter;
|
||||
}
|
||||
|
||||
public function setSubmitter(?User $submitter): self
|
||||
{
|
||||
$this->submitter = $submitter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateSubmit(): ?string
|
||||
{
|
||||
return $this->dateSubmit;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SettingsRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: SettingsRepository::class)]
|
||||
|
@ -34,6 +35,12 @@ class Settings
|
|||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $melipayamakToken = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $siteKeywords = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $discription = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
|
@ -122,4 +129,28 @@ class Settings
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSiteKeywords(): ?string
|
||||
{
|
||||
return $this->siteKeywords;
|
||||
}
|
||||
|
||||
public function setSiteKeywords(?string $siteKeywords): static
|
||||
{
|
||||
$this->siteKeywords = $siteKeywords;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDiscription(): ?string
|
||||
{
|
||||
return $this->discription;
|
||||
}
|
||||
|
||||
public function setDiscription(?string $discription): static
|
||||
{
|
||||
$this->discription = $discription;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class CommentType extends AbstractType
|
|||
->add('email',EmailType::class)
|
||||
->add('website',UrlType::class)
|
||||
->add('body',TextareaType::class,['attr'=>['autocomplete'=>'off','rows'=>5]])
|
||||
->add('submit',SubmitType::class)
|
||||
->add('submit',SubmitType::class,['label'=>'SubmitComment'])
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class BlogCommentRepository extends ServiceEntityRepository
|
|||
public function findLastComments(): array
|
||||
{
|
||||
return $this->createQueryBuilder('b')
|
||||
->where('b.publish = true')
|
||||
->orderBy('b.id', 'DESC')
|
||||
->setMaxResults(10)
|
||||
->getQuery()
|
||||
|
|
|
@ -7,17 +7,24 @@ namespace App\Service;
|
|||
use App\Entity\ChangeReport;
|
||||
use App\Entity\Settings;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
class twigFunctions
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
/**
|
||||
* @param EntityManagerInterface $em
|
||||
*/
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
protected Request $request;
|
||||
protected RequestStack $requestStack;
|
||||
|
||||
function __construct(
|
||||
EntityManagerInterface $entityManager,
|
||||
RequestStack $request
|
||||
)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->request = $request->getCurrentRequest();
|
||||
$this->em = $entityManager;
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,4 +96,8 @@ class twigFunctions
|
|||
return $this->em->getRepository(Settings::class)->findAll()[0];
|
||||
}
|
||||
|
||||
public function getCurrentUrl(){
|
||||
return $this->request->getUri();
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@
|
|||
{{ item.body }}
|
||||
</td>
|
||||
<td class="fw-semibold">
|
||||
{{ item.submitter.fullname }}
|
||||
{{ item.name }}
|
||||
</td>
|
||||
<td class="fw-semibold">
|
||||
{{ item.post.title }}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -15,7 +15,7 @@
|
|||
{% set comments = Blog.getLastComments() %}
|
||||
{% for comment in comments %}
|
||||
<div class="push">
|
||||
<b class="fw-semibold text-primary">{{ comment.submitter.fullname }}</b> در <a href="{{ path('general_blog_post',{'url':comment.post.url}) }}">{{ comment.post.title }}</a>
|
||||
<b class="fw-semibold text-primary">{{ comment.name }}</b> در <a href="{{ path('general_blog_post',{'url':comment.post.url}) }}">{{ comment.post.title }}</a>
|
||||
<p class="mt-1"> {{ comment.body }} </p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "blog/base.html.twig" %}
|
||||
{% block description %}تازههای حسابداری با وبلاگ حسابیکس{% endblock %}
|
||||
{% block title %}وبلاگ{% endblock %}
|
||||
{% block content %}
|
||||
{% for item in items %}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{% extends "blog/base.html.twig" %}
|
||||
{% block title %}{{ item.title }}{% endblock %}
|
||||
{% block description %}{{ item.title }}{% endblock %}
|
||||
{% block keywords %}{{ item.keywords }}{% endblock %}
|
||||
{% block content %}
|
||||
<main id="main-container">
|
||||
<!-- Hero -->
|
||||
|
@ -48,13 +50,6 @@
|
|||
</div>
|
||||
<!-- END Actions -->
|
||||
<div class="px-4 pt-4 rounded bg-body-extra-light">
|
||||
{% if not app.user %}
|
||||
<div class="alert alert-info">
|
||||
برای ارسال دیدگاه به حساب خود وارد شوید.
|
||||
<br>
|
||||
<a href="/login">ورود</a> | <a href="{{ twigFunctions.systemSettings().appSite }}/register">عضویت</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="rounded bg-light px-2 pt-2 pb-1">
|
||||
<h5>ارسال دیدگاه</h5>
|
||||
{{ form_start(form) }}
|
||||
|
@ -62,7 +57,7 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.name,{'attr':{'class':'required'}}) }}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6">
|
||||
{{ form_row(form.email) }}
|
||||
|
@ -77,17 +72,16 @@
|
|||
</div>
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="pt-3 fs-sm">
|
||||
<h3>دیدگاهها</h3>
|
||||
{% for comment in comments %}
|
||||
<div class="d-flex">
|
||||
<span class="flex-shrink-0 img-link me-2">
|
||||
<img alt="" class="img-avatar img-avatar32 img-avatar-thumb" src="{{ asset('https://www.gravatar.com/avatar/' ~ twigFunctions.gravatarHash(comment.submitter.email)) }}">
|
||||
<img alt="" class="img-avatar img-avatar32 img-avatar-thumb" src="{{ asset('https://www.gravatar.com/avatar/' ~ twigFunctions.gravatarHash(comment.email)) }}">
|
||||
</span>
|
||||
<div class="flex-grow-1">
|
||||
<p class="mb-1">
|
||||
<a class="fw-semibold" href="javascript:void(0)">{{ comment.submitter.fullname }}</a>
|
||||
<a class="fw-semibold" href="javascript:void(0)">{{ comment.name }}</a>
|
||||
{{ comment.body }}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,7 @@ Forget Password: بازیابی گذرواژه
|
|||
Name: نام و نام خانوادگی
|
||||
Full name: نام و نام خانوادگی
|
||||
Submit: ثبت
|
||||
SubmitComment : ثبت دیدگاه
|
||||
Keshvar: کشور
|
||||
Intero: خلاصه
|
||||
Img: تصویر شاخص
|
||||
|
|
Loading…
Reference in a new issue