General developer forum

simple moodle plugin development html form

 
Picture of Majid Noori
simple moodle plugin development html form
 

 

i am new to Moodle however i can do what i want in Php language. i need to add some functionality to Moodle admin dashboard ,it is like sending email to email address that would be filled(text field) by Moodle admin, now i wonder which type of Moodle plugin should i develope: block,admin tools or .. ?

<form action="/action_page.php" method="post">
  email address:<br>
  <input type="text" name="e_address" value="">
  <br>
  message body:<br>
  <input type="text" name="e_body" value="">
  <br><br>
  <input type="submit" value="Submit">
</form> 

then in php file(action_page.php) the process is like this:

<?php

$email_address=$_POST['e_address'];

$message=$_POST['e_body'];

// From
$header="from: admin name <admin@dfsgr.kjk>";
$subject="subjet";

$send_contact=mail($email_address,$subject,$message,$header);


if($send_contact){
echo "Email sent successfully";
}
else {
echo "ERROR";
}
?>

to be exact my question is more about plugin types and which that fits my needs and all i need is something like below image prototype


 
Average of ratings: -
Picture of Amin Farajzadeh
Re: simple moodle plugin development html form
 

I think its better to use block plugin type . this documentation may help you :

A Step-by-step Guide To Creating Blocks

 
Average of ratings: Useful (2)
Picture of Richard Oelmann
Re: simple moodle plugin development html form
Core developersParticularly helpful MoodlersPlugin developersTesters

Take a look at some of the blocks that already exist with full email functionality, and then simplify them if needed - eg

https://moodle.org/plugins/block_admin_email

https://moodle.org/plugins/block_quickmail

https://moodle.org/plugins/block_jmail

(I use Quickmail)

 
Average of ratings: Useful (1)
Picture of Majid Noori
Re: simple moodle plugin development html form
 

looking at quickmail helped. thnaks

 
Average of ratings: -