2013-10-22 00:38:10 +02:00
< form action = " <?php echo \Chibi\UrlHelper :: route ( 'post' , 'edit' , [ 'id' => $this -> context -> transport -> post -> id ]) ?> " method = "post" enctype = "multipart/form-data" class = "edit-post aligned unit" >
< h1 > edit post< / h1 >
2013-12-18 15:10:53 +01:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: EditPostSafety , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> post -> getUploader ()))) : ?>
2013-10-22 00:38:10 +02:00
< div class = "safety" >
< label class = "left" > Safety:< / label >
<?php foreach ( PostSafety :: getAll () as $safety ) : ?>
< label >
< input type = "radio" name = "safety" value = " <?php echo $safety ?> " <?php if ( $this -> context -> transport -> post -> safety == $safety ) echo 'checked="checked"' ?> />
<?php echo TextHelper :: camelCaseToHumanCase ( PostSafety :: toString ( $safety ), true ) ?>
< / label >
<?php endforeach ?>
< / div >
<?php endif ?>
2013-12-18 15:10:53 +01:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: EditPostTags , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> post -> getUploader ()))) : ?>
2013-10-22 00:38:10 +02:00
< div class = "tags" >
< label class = "left" for = "tags" > Tags:< / label >
2013-12-18 15:10:53 +01:00
< div class = "input-wrapper" >< input type = "text" name = "tags" id = "tags" placeholder = "enter some tags…" value = " <?php echo join ( ',' , array_map ( function ( $tag ) { return $tag -> name ; }, $this -> context -> transport -> post -> getTags ())) ?> " /></ div >
2013-10-22 00:38:10 +02:00
< / div >
2013-11-22 21:20:56 +01:00
< input type = "hidden" name = "edit-token" id = "edit-token" value = " <?php echo $this -> context -> transport -> editToken ?> " />
2013-10-22 00:38:10 +02:00
<?php endif ?>
2013-12-18 15:10:53 +01:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: EditPostSource , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> post -> getUploader ()))) : ?>
2013-10-22 00:38:10 +02:00
< div class = "source" >
< label class = "left" for = "source" > Source:< / label >
< div class = "input-wrapper" >< input type = "text" name = "source" id = "source" value = " <?php echo $this -> context -> transport -> post -> source ?> " /></ div >
< / div >
<?php endif ?>
2013-12-18 15:10:53 +01:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: EditPostRelations , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> post -> getUploader ()))) : ?>
2013-10-30 20:20:01 +01:00
< div class = "thumb" >
< label class = "left" for = "relations" > Relations:< / label >
2013-12-18 15:10:53 +01:00
< div class = "input-wrapper" >< input type = "text" name = "relations" id = "relations" placeholder = "id1,id2,…" value = " <?php echo join ( ',' , array_map ( function ( $post ) { return $post -> id ; }, $this -> context -> transport -> post -> getRelations ())) ?> " /></ div >
2013-10-30 20:20:01 +01:00
< / div >
<?php endif ?>
2013-12-18 15:10:53 +01:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: EditPostFile , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> post -> getUploader ()))) : ?>
2013-11-23 17:27:56 +01:00
< div class = "url" >
< label class = "left" for = "url" > File:< / label >
< div class = "input-wrapper" > < input type = "text" name = "url" id = "url" placeholder = "Some url…" / > < / div >
< / div >
< div class = "file" >
< label class = "left" for = "file" > < / label >
< div class = "input-wrapper" > < input type = "file" name = "file" id = "file" / > < / div >
< / div >
<?php endif ?>
2013-12-18 15:10:53 +01:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: EditPostThumb , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> post -> getUploader ()))) : ?>
2013-10-22 00:38:10 +02:00
< div class = "thumb" >
< label class = "left" for = "thumb" > Thumb:< / label >
2013-11-23 17:28:48 +01:00
< div class = "input-wrapper" >
< input type = "file" name = "thumb" id = "thumb" / >
<?php if ( $this -> context -> transport -> post -> hasCustomThumb ()) : ?>
< small > (Currently using custom thumb)< / small >
<?php endif ?>
< / div >
2013-10-22 00:38:10 +02:00
< / div >
<?php endif ?>
< input type = "hidden" name = "submit" value = "1" / >
< div >
< label class = "left" > < / label >
2013-11-30 14:22:49 +01:00
< button class = "submit" type = "submit" > Submit< / button >
2013-10-22 00:38:10 +02:00
< / div >
< / form >