Extensions Paheko  Check-in [046016c2a7]

Overview
Comment:Don't require user id to use taima
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | dev
Files: files | file ages | folders
SHA1: 046016c2a709f0b086e046d3a934af64c7a786da
User & Date: bohwaz on 2023-09-21 18:00:59
Other Links: branch diff | manifest | tags
Context
2023-09-21
18:00
Don't require user id to use taima Leaf check-in: 046016c2a7 user: bohwaz tags: dev
17:57
User id might be NULL if LOCAL_LOGIN is an array check-in: 602dafd3df user: bohwaz tags: dev
Changes

Modified taima/admin/index.php from [3f89aeb11d] to [cb9f6acb4d].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18





19
20
21
22
23
24
25
<?php

namespace Paheko\Plugin\Taima;

use Paheko\Plugin\Taima\Tracking;
use Paheko\Plugin\Taima\Entities\Entry;

use Paheko\Utils;


use function Paheko\{f, qg};

use KD2\DB\Date;

require_once __DIR__ . '/_inc.php';

if ($plugin->needUpgrade()) {
	$plugin->upgrade();
}






Tracking::autoStopRunningTimers();

$csrf_key = 'plugin_taima_sheet';

$form->runIf('add', function () use ($day, $user_id) {
	$entry = new Entry;








>










>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace Paheko\Plugin\Taima;

use Paheko\Plugin\Taima\Tracking;
use Paheko\Plugin\Taima\Entities\Entry;

use Paheko\Utils;
use Paheko\Users\Session;

use function Paheko\{f, qg};

use KD2\DB\Date;

require_once __DIR__ . '/_inc.php';

if ($plugin->needUpgrade()) {
	$plugin->upgrade();
}

// If there is no user id
if (!Session::getUserId()) {
	Utils::redirect('./others.php');
}

Tracking::autoStopRunningTimers();

$csrf_key = 'plugin_taima_sheet';

$form->runIf('add', function () use ($day, $user_id) {
	$entry = new Entry;

Modified taima/admin/year.php from [6eb2fcba0a] to [990024c8a6].

1
2
3
4
5


6
7





8
9
10
11
12
13
14
<?php

namespace Paheko\Plugin\Taima;

use Paheko\Plugin\Taima\Tracking;



require_once __DIR__ . '/_inc.php';






$user_id = $session->getUser()->id;
$weeks = Tracking::listUserWeeks($user_id);

$tpl->assign(compact('weeks'));

$tpl->display(\Paheko\PLUGIN_ROOT . '/templates/year.tpl');





>
>


>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

namespace Paheko\Plugin\Taima;

use Paheko\Plugin\Taima\Tracking;
use Paheko\Users\Session;
use Paheko\Utils;

require_once __DIR__ . '/_inc.php';

// If there is no user id
if (!Session::getUserId()) {
	Utils::redirect('./others.php');
}

$user_id = $session->getUser()->id;
$weeks = Tracking::listUserWeeks($user_id);

$tpl->assign(compact('weeks'));

$tpl->display(\Paheko\PLUGIN_ROOT . '/templates/year.tpl');

Modified taima/templates/_nav.tpl from [50cf8d88f5] to [5709b74ca2].

1
2
3
4
5
6
7
8

9
10

11
12
13
14
15
16
17
18
19
20
<nav class="tabs">
	{if $current == 'others'}
	<aside>
		{linkbutton target="_dialog" href="others_edit.php?id_user=%d"|args:$user.id label="Ajouter une tâche" shape="plus"}
	</aside>
	{/if}

	<ul>

		<li{if $current == 'index'} class="current"{/if}><a href="./">Ma semaine</a></li>
		<li{if $current == 'year'} class="current"{/if}><a href="year.php">Mon résumé</a></li>

{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN)}
		<li{if $current == 'others'} class="current"{/if}><a href="others.php">Autres membres</a></li>
		<li{if $current == 'stats'} class="current"{/if}><a href="stats.php">Statistiques</a></li>
{if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)}
		<li{if $current == 'report'} class="current"{/if}><a href="report.php">Valoriser</a></li>
{/if}
		<li{if $current == 'config'} class="current"{/if}><a href="config.php">Configuration</a></li>
{/if}
	</ul>
</nav>








>


>










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<nav class="tabs">
	{if $current == 'others'}
	<aside>
		{linkbutton target="_dialog" href="others_edit.php?id_user=%d"|args:$user.id label="Ajouter une tâche" shape="plus"}
	</aside>
	{/if}

	<ul>
	{if $logged_user.id}
		<li{if $current == 'index'} class="current"{/if}><a href="./">Ma semaine</a></li>
		<li{if $current == 'year'} class="current"{/if}><a href="year.php">Mon résumé</a></li>
	{/if}
{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN)}
		<li{if $current == 'others'} class="current"{/if}><a href="others.php">Autres membres</a></li>
		<li{if $current == 'stats'} class="current"{/if}><a href="stats.php">Statistiques</a></li>
{if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)}
		<li{if $current == 'report'} class="current"{/if}><a href="report.php">Valoriser</a></li>
{/if}
		<li{if $current == 'config'} class="current"{/if}><a href="config.php">Configuration</a></li>
{/if}
	</ul>
</nav>